Posted by Jack Scott on 08/02/05 02:44
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.
It is also good practice to check if there is an error and try to get
the most information available.
On Tue, 2005-08-02 at 00:44 +0200, Adi Zebic wrote:
> $insertQuery = "Insert into TABLE values (".$this ->
> firstName.",".$this
> -> lastName)");
> $db = new DB;
> $db -> query($insertQuery);
[Back to original message]
|