Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-29-2003, 03:24 PM   #1
Registered: Feb 2002
Distribution: xubuntu 8.10
Posts: 225

Rep: Reputation: 31
perl DBI prepare question

Why won't this work?
$sql = "select date from ? where user=?";
$sth = $dbh->prepare($sql) ||
         die print "Couldn't prepare statement:\n$DBI::errstr\n";
$sth->execute( $treename, $owner) || die "could not execute sql:\n$sql";
I get this:
DBD::mysql::st execute failed: You have an error in your SQL syntax near 
''export' where user='postman'' 
at line 1 at ./ line 180, <QUOTAS> line 4. could not execute sql: 
select date from ? where user=? at ./ line 180, <QUOTAS> line 4.
I notice there are single quotes in the error I get before: 'export...
and after: ...postman'

I don't think they should be there. How do I get them out?
Old 10-30-2003, 03:12 PM   #2
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
The single quotes before export and after postman are just mysql's way of saying ' .... this crap .....'

I think I see what's wrong here:

You have single quotes around 'export'. That's a no-no. Try ->execute('export', "'postman'");


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Perl DBI question GoTrolling Linux - Newbie 1 03-21-2007 05:31 AM
Mysql reading via Perl DBI ivanatora Programming 2 03-21-2007 05:03 AM
Perl - DBI PG Installation Problems TheMeteorPolice Linux - Software 2 11-23-2005 11:53 AM
perl | DBI->connect | RHEL AS 3 kaN5300 Linux - Enterprise 6 09-14-2004 09:15 AM
Perl Sqlite DBI $sth->rows The Jesus Programming 0 10-22-2003 12:35 AM

All times are GMT -5. The time now is 11:36 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration