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

Posted by Michael Fesser on 11/21/06 02:32

..oO(Chris Hope)

>Wow, that's really hard to read... is there are reason you keep opening
>and closing the string? It would be much easier to write it like this:
>
>$query="UPDATE table_name set
> First_Name = \"$formVars[First_Name]\",
> Date_Committed = \"$formVars[Date_Committed]\",
> Signed_By = \"$formVars[Signed_By]\",
>...
>";

Even simpler and more SQL-compliant with single quotes:

$query="UPDATE table_name set
First_Name = '$formVars[First_Name]',
Date_Committed = '$formVars[Date_Committed]',
Signed_By = '$formVars[Signed_By]',
....
";

>If you use the PEAR DB library, ADODB or ADODB_Lite (and other database
>libraries that are out there) instead of the straight php mysql_*
>functions, you'll be able to use variable binding which helps to
>eliminate the sql injection issues, and also can make your code a lot
>easier to read.

http://www.php.net/pdo

Micha

 

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

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