------------------------------------------------
On Thu, 11 Sep 2003 08:39:06 -0500, "Dan Muey" <[EMAIL PROTECTED]> wrote:

> > Hi,
> 
> Howdy
> 
> > 
> > First, sorry for the wrap on the lines below. I am trying to 
> > insert some 
> > values into a mySQL database, all of the scalars below have a value 
> > (none are undefined). I keep getting errors similar to the 
> > one below and 
> > despite being instructed to read the mySQL manual, I cannot find 
> > anything that relates to the problem I'm experiencing.
> > 
> > Is the problem with my Perl (likely), or mySQL?
> > Can anyone offer a solution or pointers towards possible solutions?
> > 
> > Thank you in advance for any help you may be able to provide.
> > 
> > CODE:
> > 
> > my $dbh = DBI->connect("DBI:mysql:database","username","password");
> > my $result = $dbh->prepare("INSERT INTO table(               
> > sitename,siteurl,category,description,country,region,city,adde
> > d,expires,submitted) 
> > VALUES (?,?,?,?,?,?,?,?,?,?)"); 
> > $result->execute($sitename,$siteurl,$category,$description,$co
> > untry,$region,$city,$added,$expires,$submitted);
> > print $dbh->errstr(),"\n" unless ($result);
> > $dbh->disconnect();
> > 
> > ERROR:
> > 
> > DBD::mysql::st execute failed: You have an error in your SQL syntax. 
> > Check the manual that corresponds to your MySQL server 
> > version for the 
> > right syntax to use near 
> > database(sitename,siteurl,category,description,country,region, at 
> > /home/gl/httpd/index.pl line 403., referer: http://gl.example.com/
> > 
> 
> Besides having atable named table not 'table' being illegal.
> You may have problems with the strings being un quoted, I could be wroing but I'd 
> have a look at that.
> Look at $dbh->quote();
> 

Though now I can't seem to find where I read it, by calling 'execute' with binding 
values quoting is performed automagically by eitehr DBI or the driver.   From the docs 
for the 'quote' method:  "There is no need to quote values being used with 
"Placeholders and Bind Values"."

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to