RE: Update Query Help...

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

 



	I have definitely isolated the problem.  If I change the column name
that the match is being performed on from 'id-sys' to 'id_sys' I can execute
the query without having to worry about quoting the column name and
everything works.  I think that I am just going to leave the column name
changed and take this as a lesson never to use '-' in a column name again.
	Thanks again for the help.  Maybe we all learned something from
this.

-----Original Message-----
From: DL Neil [mailto:PHPml@DandE.HomeChoice.co.uk]
Sent: Tuesday, December 10, 2002 2:00 PM
To: NIPP, SCOTT V (SBCSI); '1LT John W. Holmes'; php-db@lists.php.net
Subject: Re:  Update Query Help...


SCOTT,
The list's crystal ball filter is down for maintenance.
Show us the tbl schema and the debug print of $update.
Then we won't be firing blind!
=dn


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

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