geebo Posted November 11, 2007 Share Posted November 11, 2007 Well, thanks to Daukan I no longer get an error message with my php script, but unfortunately, no data gets posted to the database So, I am guessing that the connection to the database is successful, but something is not working after that. Here is my script again: <?php $name=$HTTP_POST_VARS['Name']; $date=$HTTP_POST_VARS['Date_']; $comments=$HTTP_POST_VARS['Comments']; $username="garyboha_*******"; $password="*******"; $database="garyboha_eortutorial"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); mysql_query($query); $query = "INSERT INTO eorresults (name, date, comments) VALUES ('$name', '$date', '$comments')"; mysql_close(); ?> Here is my php admin panel for the database: This should be simple. Thanks in advance for helping a total noob (and I mean noob on this one). Link to comment https://forums.phpfreaks.com/topic/76884-solved-php-script-not-posting-to-database/ Share on other sites More sharing options...
BlueSkyIS Posted November 11, 2007 Share Posted November 11, 2007 you run mysql_query() on $query before $query is defined. add or die(mysql_error()) and you'll see this. mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/76884-solved-php-script-not-posting-to-database/#findComment-389262 Share on other sites More sharing options...
geebo Posted November 11, 2007 Author Share Posted November 11, 2007 Makes sense, one must define a query before one can run a query. Thanks for the help. MUCH APPRECIATED! Link to comment https://forums.phpfreaks.com/topic/76884-solved-php-script-not-posting-to-database/#findComment-389292 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.