Query returns "Resource Identifier #6" instead of
Posted: Wed May 14, 2003 5:37 pm
I have a script where I insert data for a customer into a table. The table has a primary key which automatically updates (INT NOT NULL AUTO_INCREMENT). I want to insert a row into the table, and then find out what ID I just inserted.
Here's the first query which inserts data into the ClientSales table.
$secondquery = "INSERT INTO ClientSales (ClientNameID, SalesFName, SalesLName) values ('$theclientid', '$FName','$LName')";
mysql_query($secondquery);
This table has the primary, unique key. The data goes in perfectly, no errors or problems. Now, since I just entered data, I want to find out what number MySQL automatically generated. So, I run this script
$findtheid = "SELECT ClientSalesID FROM ClientSales WHERE SalesFName = '$FName' AND SalesLName = '$LName'";
$findtheidresult = mysql_query($findtheid);
$findtheidresult returns Resource Identifier #6 instead of the data I'm tryin got call. Where is my error?
Here's the first query which inserts data into the ClientSales table.
$secondquery = "INSERT INTO ClientSales (ClientNameID, SalesFName, SalesLName) values ('$theclientid', '$FName','$LName')";
mysql_query($secondquery);
This table has the primary, unique key. The data goes in perfectly, no errors or problems. Now, since I just entered data, I want to find out what number MySQL automatically generated. So, I run this script
$findtheid = "SELECT ClientSalesID FROM ClientSales WHERE SalesFName = '$FName' AND SalesLName = '$LName'";
$findtheidresult = mysql_query($findtheid);
$findtheidresult returns Resource Identifier #6 instead of the data I'm tryin got call. Where is my error?