MySQL query error
am 30.06.2007 23:17:05 von James Blandford
Hello,
I am making a private messaging system for my website, and if you click on
the pm, it --should-- set it as "read" rather than "unread". I am using the
query:
UPDATE pms SET read=1 WHERE id='{$assoc['id']}'
but it is giving me this error:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'read=1 WHERE
id='4'' at line 1
To me, this query looks perfectly fine, but obviously it isn't. Please can
you tell me how to make it work.
Cheers,
James
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MySQL query error
am 30.06.2007 23:55:57 von Stut
James Blandford wrote:
> Hello,
> I am making a private messaging system for my website, and if you click
> on the pm, it --should-- set it as "read" rather than "unread". I am
> using the query:
> UPDATE pms SET read=1 WHERE id='{$assoc['id']}'
> but it is giving me this error:
> You have an error in your SQL syntax; check the manual that corresponds
> to your MySQL server version for the right syntax to use near 'read=1
> WHERE id='4'' at line 1
> To me, this query looks perfectly fine, but obviously it isn't. Please
> can you tell me how to make it work.
Query looks fine. Are you sure the table and field names are correct?
-Stut
--
http://stut.net/
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MySQL query error
am 01.07.2007 00:10:09 von Stut
Please include the list when replying.
James Blandford wrote:
> It seems i have fixed it >_< thanks for your time thou. It turns out
> that I couldn't have "read" as a field name due to some random reason. I
> changed it to "itsread" and it works perfectly :0)
It wasn't a random reason - "read" is on the reserved words list:
http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
-Stut
--
http://stut.net/
> ----- Original Message ----- From: "Stut"
> Newsgroups: php.windows
> To: "James Blandford"
> Cc:
> Sent: Saturday, June 30, 2007 10:55 PM
> Subject: Re: [PHP-WIN] MySQL query error
>
>
>> James Blandford wrote:
>>> Hello,
>>> I am making a private messaging system for my website, and if you
>>> click on the pm, it --should-- set it as "read" rather than "unread".
>>> I am using the query:
>>> UPDATE pms SET read=1 WHERE id='{$assoc['id']}'
>>> but it is giving me this error:
>>> You have an error in your SQL syntax; check the manual that
>>> corresponds to your MySQL server version for the right syntax to use
>>> near 'read=1 WHERE id='4'' at line 1
>>> To me, this query looks perfectly fine, but obviously it isn't.
>>> Please can you tell me how to make it work.
>>
>> Query looks fine. Are you sure the table and field names are correct?
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: MySQL query error
am 07.07.2007 13:12:02 von El Bekko
Not to mention that read would most likely be a tinyint(1), and thus
shouldn't be fed a character.
Stut wrote:
> Please include the list when replying.
>
> James Blandford wrote:
>> It seems i have fixed it >_< thanks for your time thou. It turns out
>> that I couldn't have "read" as a field name due to some random reason.
>> I changed it to "itsread" and it works perfectly :0)
>
> It wasn't a random reason - "read" is on the reserved words list:
> http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html
>
> -Stut
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php