LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



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

Rep: Reputation: 31
perl DBI prepare question


Why won't this work?
Code:
$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:
Code:
DBD::mysql::st execute failed: You have an error in your SQL syntax near 
''export' where user='postman'' 
at line 1 at ./rsyring_netapp_quota_db.pl line 180, <QUOTAS> line 4. could not execute sql: 
select date from ? where user=? at ./rsyring_netapp_quota_db.pl 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
lackluster
Member
 
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'");
 
  


Reply


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 05:10 AM.

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