You are here: Re: [PHP] mysql insert function « PHP « IT news, forums, messages
Re: [PHP] mysql insert function

Posted by Richard Lynch on 04/19/05 05:45

On Sun, April 17, 2005 10:56 am, Dasmeet Singh said:
> I regularly need to insert data into MySQL.. and instead of writing
> Insert query everytime i wrote this function... and it works well..
>
> Please see and tell is it a good idea using this..or there might be
> problems with it?

It's not a Bad Idea, but what are you really saving with all this?

AFTER:
> $fields=array(
> "Title" => $Title,
> "OwnerMemberId" => $memberid,
> "Address" => $Address,
> "City" => $City,
> "State" => $State,
> "Pin" => $Pin
> );
>
> insertArray("Property", $fields);

BEFORE:
$query = "insert into Property (Title, OwnerMemberId, Address, City,
State, Pin) ";
$query .= " values ('$Title', $memberID, '$Adress', '$City', '$State',
'$Pin') ";
db_query($query);

Seems to me you haven't saved any characters in typing, nor made the code
significantly more clear to the reader.

That's just my take. Everybody and their brother does it your way.
[shrug]

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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