Setup :
MySQL 3.23.42
Perl 5.6.0
DBI 10.32
I’m trying to do a few different queries where the table name needs to be
dynamic. I’ve tried the following :
$dbquery = $dbhandler->prepare_cached(“SELECT id, target FROM ? where
somedata=?”);
$dbquery->execute($tablename,$somedata);
But I keep getting an error…. The error looks something like this :
DBD::mysql::st execute failed: You have an error in your SQL syntax near
''mod1' where id='test.1'' at line 1 at ClassMRTGDB.pm line 73.
DBD::mysql::st fetchrow_array failed: fetch() without execute() at
ClassMRTGDB.pm line 75.
Anyone know why this isn’t working? Do I have to specify the table name in
the actual prepare statement every time?
Also, assuming I only run execute’s after I first define $dbquery, is
$dbquery guaranteed to be there until the program exits? (I’m not
redefining $dbquery at any time…) I’m pretty sure it is, so I’m just
checking.. Otherwise I need to write code to check on it.. ☺
Thanks,
---------------------------
Jason H. Frisvold
Senior ATM Engineer
Engineering Dept.
Penteledata
CCNA Certified - CSCO10151622
[EMAIL PROTECTED]
---------------------------
"So Long and Thanks for all the Fish" -- Douglas Adams [1952-2001]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php