RE: [PHP-DB] Update Query Help...
| From: | SBCSI) | Date: | Tue, 10 Dec 2002 19:56:38 +0000 |
| Subject: | RE: [PHP-DB] Update Query Help... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24031@lists.php.net to get a copy of this message | ||
I understand that the column name does not normally need quotes, but
without quotes on the column name I get a mysql error message about no
column named 'id'. Unfortunately, I cannot even get the UPDATE statement
working outside of PHP through an direct SQL statement. Everything looks
like it should work, but the affected columns is always zero, and obviously
the atime column is not getting the timestamp.
This is quite frustrating. Thanks again for the help. Hopefully
someone will come up with something to help me get this working.
-----Original Message-----
From: 1LT John W. Holmes [mailto:holmes072000@charter.net]
Sent: Tuesday, December 10, 2002 1:45 PM
To: NIPP, SCOTT V (SBCSI); php-db@lists.php.net
Subject: Re: [PHP-DB] Update Query Help...
> $tmp = $_POST['sbcuid']."-".$_POST['system'][$a];
> $update = "UPDATE accounts SET atime='NOW()' WHERE
> \"id-sys\"='".$tmp."'";
> echo $update;
> $result1 = mysql_query($update, $Prod) or die(mysql_error());
> echo mysql_affected_rows();
Try:
$update = "UPDATE accounts SET atime=NOW() WHERE id-sys='$tmp'";
NOW() is a function, don't enclose it within quotes and make it a string.
You don't put quotes around column names, either, only string values.
---John Holmes...