Re: Re: SOLVED - [PHP] php-mySQL insert problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



no prob ;-)

On Tue, 2005-08-02 at 02:27 +0200, Adi Zebic wrote:
> 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
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux