asra_baig@rocketmail.com wrote:[color=blue]
> I have a MySQL database and I'm able to access it correctly. I am also
> able to execute select, update and insert queries, however I am getting
> warnings saying:
> "supplied argument is not a valid MySQL result resource" and the result
> set returned is empty (for queries other than select).
> Strangely, my die function includes the query but the query is not
> printed. I've however printed the queries before executing and they are
> fine too. Can anyone discover the problem? The code is as below:
> (please also note that as the code below has @'s the warnings are not
> displayed)[/color]
UGH! UUUGGHHHHH!!!!!!! OUCH!!!
Please, indent your code before pasting it to the newsgroups.
<snip>
[color=blue]
> $update_query = "UPDATE `Shopping` SET `Merchant ID` = " .
> $merchant_id . " , `quantity`= " . $_POST['quantity'] .
> $where_clause;
> echo $update_query;
> $update_result = @mysql_query($update_query, $connection) or
> die(mysql_error() . ": $update_query");
> /* Error comes here */
> if(($result = @mysql_fetch_array($update_result)))[/color]
<snip>
OUCH!!!!!!!! MY EYES HURT!!!!!!!!!!
Please, indent your code before pasting it to the newsgroups.
mysql_fetch_*() functions are only valid after a mysql_query() for
SELECT, SHOW, EXPLAIN or DESCRIBE.
for UPDATE, INSERT, DELETE, ... the mysql_query() is all you need.
*Read* the mysql_query() manual page.
http://www.php.net/mysql_query
Please, indent your code before pasting it to the newsgroups.
--
Mail to my "From:" address is readable by all at
http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!