Re: PHP and MySQL bug
| From: | Stefan Hinz, iConnect \(Berlin\) | Date: | Sat, 04 Jan 2003 15:58:29 +0000 |
| Subject: | Re: PHP and MySQL bug | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130252@lists.php.net to get a copy of this message | ||
Nuno,
> $r=MYSQL_QUERY("SELECT n,u,m,h FROM d WHERE id='$id'");
>
> /* Some code including "mysql_num_rows" and "mysql_fetch_array($r,
> MYSQL_NUM)"
> And the another query:
> */
>
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> /* i don't know why but this doesn't work!*/
It doesn't work because of the /* Some code including ... */ part ;-)
First thing, I would check if $h and $id really are what you expect them
to be, like:
$sql = "UPDATE d SET h='$h' WHERE id='$id'";
echo $sql;
MYSQL_QUERY($sql);
If this part is okay, then the problem lies within this myterious /*
Some code */.
Regards,
--
Stefan Hinz <hinz@iConnect.de>
Geschäftsführer / CEO iConnect GmbH <http://iConnect.de>
Heesestr. 6, 12169 Berlin (Germany)
Tel: +49 30 7970948-0 Fax: +49 30 7970948-3
----- Original Message -----
From: "Nuno Lopes" <nunoplopes@clix.pt>
To: <mysql@lists.mysql.com>; <php-general@lists.php.net>
Sent: Saturday, January 04, 2003 11:46 AM
Subject: PHP and MySQL bug
> Dear Sirs,
>
> I'm using PHP and MySQL to make my programs. But I think I discovered
a bug
> in PHP or in MySQL (I don't know!).
>
> In one of my files I have the following:
>
> MYSQL_CONNECT("localhost", "**user**", "**pass**");
> mysql_select_db("be");
> $r=MYSQL_QUERY("SELECT n,u,m,h FROM d WHERE id='$id'");
>
> /* Some code including "mysql_num_rows" and "mysql_fetch_array($r,
> MYSQL_NUM)"
> And the another query:
> */
>
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> /* i don't know why but this doesn't work! But if I close the
connection and
> open another te query is done:*/
>
> MYSQL_CLOSE();
> MYSQL_CONNECT("localhost", "**user**", "**pass**");
> mysql_select_db("be");
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> ---------------
> I don't know why is this? Because I'm used to do more than a query per
> connection and this never happened!
> I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3.
>
>
> I hope you solve this,
> Nuno Lopes
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread128988@lists.mysql.com>
> To unsubscribe, e-mail
<mysql-unsubscribe-list_hinz=iconnect.de@lists.mysql.com>
> Trouble unsubscribing? Try:
> http://lists.mysql.com/php/unsubscribe.php
>