Echo your INSERT statement, so that you know what it looks like, if you 
have the values you expect, field names are spelled correctly. that you're 
not inserting char into int, etc.

Use mysql_errno() and mysql_err() (Check those against manual to determine 
what error you are getting. Use mysql_affected_rows() to determine the 
number of rows which were inserted.

Finally, you aren't assigning the return value from mysql_query(), so if 
you are testing a variable on line 24 it has nothing assigned to it.

HTH - Miles Thompson

At 02:44 PM 5/5/2002 +0800, erich wrote:
>when i perform query an mysql db, to insert a new record, the PHP says:
>
>Warning: Supplied argument is not a valid MySQL result resource in
>g:\wwwroot\phpusermanager-1.0\add_order.php on line 24
>
>the snippet is as follows
><?
>// connect to the database
>$conn = mysql_connect ($db_host, $db_user, $db_passwd);
>
>// select database
>mysql_select_db ($db_used, $conn);
>
>// SQL statement
>$query = "INSERT into order (Ctr_no, OID, Person_in_charge, Source,
>Destination, Status)
>        VALUES ('$container_num', '$order', '$referrer', '$source', '$dest',
>'$status')";
>mysql_query ($query, $conn);
>
>mysql_close($conn);
>?>
>
>why the argument isn't valid? how to solve this problem?
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to