Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PHP-DB] MySQL/PHP Update

0 views
Skip to first unread message

Jason

unread,
Mar 28, 2002, 11:03:00 AM3/28/02
to Php-Db, Rick Emery
Actually... this turned out to be something totally unrelated. Thanks for
all the interest tho.

Missing little things like variable spelling is why you shouldn't code for
18 hours straight.

Jason Cathcart
Check Out My Site: http://www.biohazardous.org


-----Original Message-----
From: Rick Emery [mailto:rem...@excel.com]
Sent: March 28, 2002 7:20 AM
To: 'Jason'; Php-Db
Subject: RE: [PHP-DB] MySQL/PHP Update


Jason, this is intriguing.

Please show us a bit more code before the mysql_query() call.

-----Original Message-----
From: Jason [mailto:b...@biohazardous.org]
Sent: Thursday, March 28, 2002 1:54 AM
To: Php-Db
Subject: [PHP-DB] MySQL/PHP Update


I'm trying to update my MySQL database, but it doesn't seem to be taking.

my code is:

mysql_query("update prod_list set prod_manu=$prod_man where sku='$prod'");

where
prod_manu is an int
$prod_man is an int
sku is a varchar
$prod is text

mysql_query() comes back successful, and just to be sure I echoed
mysql_error() and nothing came back.

What am I doing wrong?

Jason Wong

unread,
Mar 28, 2002, 10:05:12 AM3/28/02
to php...@lists.php.net
On Thursday 28 March 2002 17:04, cristi radulescu wrote:
> i think the problem is bad syntax:
> you should try:

>
> mysql_query("update prod_list set prod_manu=$prod_man where
> sku='".$prod."'");
>
> that is because when you have single quotes you will not evaluate the
> expression so your querry will do the update only for sku equally with
> the string '$prod'...

I'm afraid that is incorrect.

Try it for yourself:

<?
$doo = 'dah';
echo "Doo is '$doo'";
?>

His problem lies elsewhere.


--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Nature abhors a virgin -- a frozen asset.
-- Clare Booth Luce
*/

Rick Emery

unread,
Mar 28, 2002, 9:20:29 AM3/28/02
to Jason, Php-Db

Cristi Radulescu

unread,
Mar 28, 2002, 4:04:48 AM3/28/02
to php...@lists.php.net
i think the problem is bad syntax:
you should try:

mysql_query("update prod_list set prod_manu=$prod_man where sku='".$prod."'");

that is because when you have single quotes you will not evaluate the
expression so your querry will do the update only for sku equally with
the string '$prod'...

hope this help,
cristi radulescu

MU> Jason a écrit :

>> I'm trying to update my MySQL database, but it doesn't seem to be taking.
>>
>> my code is:
>>
>> mysql_query("update prod_list set prod_manu=$prod_man where sku='$prod'");
>>
>> where
>> prod_manu is an int
>> $prod_man is an int
>> sku is a varchar
>> $prod is text
>>
>> mysql_query() comes back successful, and just to be sure I echoed
>> mysql_error() and nothing came back.
>>
>> What am I doing wrong?

MU> if you already have an row with that data, mysql doesn't update the db...

MU> do an echo $query to see what exactly is executed.
MU> ($query = "update prod_list set prod_manu=$prod_man where sku='$prod'")


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Marius Ursache

unread,
Mar 28, 2002, 3:06:36 AM3/28/02
to Php-Db

Jason a écrit :

> I'm trying to update my MySQL database, but it doesn't seem to be taking.
>
> my code is:
>
> mysql_query("update prod_list set prod_manu=$prod_man where sku='$prod'");
>
> where
> prod_manu is an int
> $prod_man is an int
> sku is a varchar
> $prod is text
>
> mysql_query() comes back successful, and just to be sure I echoed
> mysql_error() and nothing came back.
>
> What am I doing wrong?

if you already have an row with that data, mysql doesn't update the db...

do an echo $query to see what exactly is executed.


($query = "update prod_list set prod_manu=$prod_man where sku='$prod'")

--
Marius Ursache (3563 || 3494)

\|/ ____ \|/
"@'/ ,. \`@"
/_| \__/ |_\
\__U_/


0 new messages