On 6 Jun 2001, at 14:44, SAWMaster wrote:
> So now I'm playing with this line...I think it's where my error is.
> $sqlstatement = "INSERT INTO Full (freq, loc, desc, freqtype, cat, 
call,
> tx) VALUES ($newfreq, $newloc, $newdesc, $newfreqtype, $newcat, 
$newcall,
> $newtx)";
> Can someone set me straight on this?

Instead of building a sql statement like the above, I would suggest using 
placeholders. The DBI will "do the right thing" in regards to placing the 
needed quotes around the values so you don't have to fight with your 
SQL statements. This also gives a performance boost if you reuse your 
sql statement to insert additional values. See the section in the DBI pod 
about Placeholders and Binding Values.

Using placeholders, your code would look like:

$sqlstatement = "INSERT INTO Full (freq, loc, desc, freqtype, cat, call, 
tx) VALUES (?,?,?,?,?,?,?)";
$sth = $dbh->prepare($sqlstatement) || die $dbh->errstr;
$sth->execute($newfreq, $newloc, $newdesc, $newfreqtype, $newcat, 
$newcall, $newtx) || die $dbh->errstr;


Good luck,
William

Reply via email to