[prev in list] [next in list] [prev in thread] [next in thread] 

List:       msqlperl
Subject:    Re: Inserting data with perlmsql
From:       "Nathan Byrd" <techy () www ! thinice ! com>
Date:       1996-08-28 16:19:35
[Download RAW message or body]

On Wed, 28 Aug 1996, Stephen Brenner wrote:

> I'm having trouble figuring out how to insert data into a table with
> perlmsql interface. I can connect to the database, get information from
> it, etc. but I can't enter in new data via the perlmsql.
> 
<snip>
> 
> $sth =$dbh->query("Insert into crafters VALUES ($lastname, $firstname,
> $boothno, $boothname)\\g");
> 
> $sth =$dbh->query("Insert into crafters, $lastname, $firstname, $boothno,
> $boothname");
> 

They look pretty close...  Remember, char data has to be quoted...  Heres 
what is should look like (I'm making educated guesses about which ones 
are strings :-):

$sth=$dbh->query("insert into crafters values 
('$lastname','$firstname',$boothno,'$boothname')");

Remember $Msql::db_errstr is your friend... Try placing one 
directly after your insert, like:

$sth=$dbh->query("insert into crafters values 
('$lastname','$firstname',boothno,'$boothname')");
print "The error is: $Msql::db_errstr\n";

Also, make sure your msql.acl file has permissions set right, especially 
if your using this as a web interface... I hope this helps,

Nathaniel Byrd
Thin Ice Communications

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic