You are here: Re: PHP MySql Update « PHP Programming Language « IT news, forums, messages
Re: PHP MySql Update

Posted by Marcin Dobrucki on 11/21/06 13:15

Akhenaten wrote:
> Coding apparently leads to blindness! I have an unclosed quote in here
> and I'm not sure where......
>
> $query="UPDATE table_name set ".
> "First_Name= \"".$formVars["First_Name"]."\",".
> "Date_Committed= \"".$formVars["Date_Committed"]."\",".
> "Signed_By= \"".$formVars["Signed_By"]."\",".
> "Rep= \"".$formVars["Sales_Rep"]."\",".
> "Aut= \"".$formVars["Atty"]."\",".
> "Car= \"".$formVars["Car"]."\",".
> "Dbl= \"".$formVars["Dbl"]."\",".
> "Sts= \"".$formVars["Sts"]."\",".
> "Notes= \"".$formVars["Notes"]."\",".
> " \"WHERE Client_ID = \"".$formVars["Client_ID"]."\"";
>
> mysql_query($query);
>
> Your eyesite is appreciated!

Instead of doing this, I would suggest taking some wrapper which
builds the querries from you based on an array of values. This is a
sure way of creating code that's very difficult to maintain. Eg. you
want to add something to your tables in the next update, and you have to
insert just the right code in the right place into this mess. Perhaps
PEAR::MDB2 to the rescue?

 

Navigation:

[Reply to this 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

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