RE: Update Query Help...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	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:  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...

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux