saghir69
03-28-2008, 04:22 PM
Hi
I'm sure it will be simple for someone who is good with php.
// i'm adding some data to my db - this works
mysql_query("INSERT INTO table (orderid, otherfield)
VALUES ('" . $orderid . "','" . $otherfield. "') ") or die(mysql_error());
// to continue with my script I need the row "id" of the row I just entered above. "id" is a field in my db set to auto_increment
// is there a easy way to get that
// this is how i'm trying but i'm geting a odd error
$result = mysql_query("select id from table Where orderid = $orderid", $link)
or die ("Could not read data because ".mysql_error());
// print the data in a table
if (mysql_num_rows($result)) {
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
when i run this script i get this error
Could not read data because Unknown column '676777d676' in 'where clause'
'676777d676' is the value of $orderid
can someone spot what i'm doing wrong?
I'm sure it will be simple for someone who is good with php.
// i'm adding some data to my db - this works
mysql_query("INSERT INTO table (orderid, otherfield)
VALUES ('" . $orderid . "','" . $otherfield. "') ") or die(mysql_error());
// to continue with my script I need the row "id" of the row I just entered above. "id" is a field in my db set to auto_increment
// is there a easy way to get that
// this is how i'm trying but i'm geting a odd error
$result = mysql_query("select id from table Where orderid = $orderid", $link)
or die ("Could not read data because ".mysql_error());
// print the data in a table
if (mysql_num_rows($result)) {
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
when i run this script i get this error
Could not read data because Unknown column '676777d676' in 'where clause'
'676777d676' is the value of $orderid
can someone spot what i'm doing wrong?
