You are here: Help with writing data to MySQL database using PHP « PHP Programming Language « IT news, forums, messages
Help with writing data to MySQL database using PHP

Posted by Bryan on 09/23/06 02:15

Hello all,

Can anyone tell me why the following code isn't working?

$dbh = mysql_connect($host,$user,$pass) or die("Couldn't connect...");
$selected = mysql_select_db($db,$dbh);
$name = $_GET['name'];
$state = $_GET['state'];
$desc = $_GET['desc'];
$lat = $_GET['lat'];
$lng = $_GET['lng'];
$result = mysql_query("INSERT INTO re_cities (name, state, description,
lat, lng) VALUES ('$name','$state','$desc','$lat','$lng')");

The script doesn't die when I attempt to connect so I'm assuming that
isn't the problem. I'm pretty sure I also get a result because the
following code echoes "City Add Successful".

if ($result) {
echo "City Add Successful";
} else {
echo "City Add Unsuccessful";
}

However, the data doesn't show up in the database. Any suggestions?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация