[thelist] mySQL/PHP - INSERT not working [UPDATED]

Tom Dell'Aringa pixelmech at yahoo.com
Thu Jun 17 10:42:42 CDT 2004


Okay, I adjusted the code as follows:

---------
$conn = mysql_connect($hostname, $dbusername, $dbpassword);
if (!$conn) {
   die('Could not connect: ' . mysql_error());
}

$scout = $_POST['scoutReport'];
$pid   = $_POST['pid'];
$result = mysql_query("INSERT INTO scouting (playerID, report) VALUES ('" . $pid ."','" . $scout .
"')", $conn);

if (!$result) {
   die('Invalid query: ' . mysql_error());
}
-----------

And I'm getting the following error:

Invalid query: No Database Selected

How can that be if $conn didn't fail? Do I somewhere have to specify the name of the DB? 

Tom

=====
http://www.Pixelmech.com/ - read my latest blog posting!

John 3:16





More information about the thelist mailing list