You are here: Re: SOLVED - [PHP] php-mySQL insert problem « PHP « IT news, forums, messages
Re: SOLVED - [PHP] php-mySQL insert problem

Posted by Adi Zebic on 08/02/05 03:27

Jack Scott a écrit :
> Try this:
> $insertQuery = "Insert into TABLE
> (
> col_one,
> col_two
> )values (
> '" . $this -> firstName . "',
> '" . $this-> lastName . "'
> )";
> $db =& new DB;
> $res = $db->query($insertQuery);
> if(DB::isError($res)){
> exit("Insert query failed: ".__FUNCTION__."() <br>in file
> ".__FILE__."<br>on line ".__LINE__."<br>".$res->getDebugInfo());
> }else{
> return;
> }
>
> you need to have quotes arround your varchar items and you should also
> specify which column you want the values to go into.

Yess! That's the right one :-)

> It is also good practice to check if there is an error and try to get
> the most information available.

"DB" class do the right thing with try/catch.

THANK YOU VERY VERY MUCH Jack Scott!

ADI

 

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

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