Reply to Re: mysql_error on an update

Your name:

Reply:


Posted by Jim Michaels on 02/11/06 23:42

"Jim Michaels" <jmichae3@nospam.yahoo.com> wrote in message
news:Bu6dnV71AOzYxHPenZ2dnUVZ_t6dnZ2d@comcast.com...
>
> "Jeff" <joesiege@gmail.com> wrote in message
> news:1138722255.036505.213460@f14g2000cwb.googlegroups.com...
>> What's the best practice for handling the following situation, when I
>> do an update like this:
>>
>> $sql = "UPDATE haha SET papa="loco" WHERE id=$var";
>> $res = mysql_query($sql,$db);
>
> Why are you not escaping your \" quotes around loco?

I am surprised you didn't get a parse error from PHP. that middle quote
causes a premature end of string. so your query would be "UPDATE haha SET
papa=" and that's it. that's probably why it was failing. if you want to
really see what it looks like, echo it to see how the parser sees it.

>
>>
>> If I don't get a match in my where clause, i.e., 12!=44 the UPDATE does
>> not occur but mysql_errno == 0 and mysql_error = "" so I can't capture
>> the failure.
>>
>> Any thoughts?
>>
>> Jeff
>>
>
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация