Vinetop
 
{ Guest } - Login Browse 
:: Browse Topic Focus
Journal
General
How-To & DIY
Tips & Tricks
Reviews
 

SELECT query input must be integer - Atom8 - Jan 08, 2008 2:20pm
Tips & Tricks @ Technology / Computers / Progamming Languages / Perl - Views (8222) - Ratings(1): ( 1.00 )
This is an example of an unusual syntax error for no obvious reasons. The DBI keep returning error string as a syntax error in the last element of the query string 'limit ?'.

1) The calling CGI code:
...
myFunc(param('itemCounts'));
...


2) The Perl library function:
sub myFunc {
my $limit = shift @_;

my $dbh = connectMyDB();
my $sth = $dbh->prepare('SELECT * from myProducts order by itemID DESC limit ?') or return die 'Unable to set handle.';

$sth->execute($limit) or print $sth->errstr;
...
}

---------------------------

This will ALWAYS cause a syntax error when $sth->execute() is called.

---------------------------
3) The Fix:

Modify to have $sth->execute(int($limit)) . The SELECT query was expecting type integer and param('itemCounts') in the CGI context returned as strings/text value.

Last Edit: Jan 08, 2008 10:21pm - by Atom8        Comments | Report




Tag This Post For Review:
:: Select Report Reasons:

(Spam or other useless content)
topic or content
violations (or plagarism) - Specify source infos below
post - Paste source link below
type (Topic is NOT: Tips & Tricks)
(Category should NOT be in Technology / Computers / Progamming Languages / Perl)


:: Additional Comments or Other Reasons:


:: You are not logged in. Please fill out the fields below:
Name: **Optional
Email: **Optional
FormKey: Enter FormKey Here: **Required

This topic will be reviewed by Vinetop Reviewers. It will be removed, changed or edited if deemed inappropriate by its content or preference. Meanwhile, it will be available to all readers with a tagged status.

Tips & Tricks

Recent Posts
The Invincible CELL Soldier in Crysis 2 - An Easter Egg?
:: Atom8 - Feb 13, 2012 3:45am

Inside Out of the Samsung Infuse 4G
:: Atom8 - Feb 03, 2012 4:31am

Update FW to 2.3.4 Gingerbread for T-Mobile Vibrant (Samsung Gal...
:: Atom8 - Jul 10, 2011 3:41pm

iPhone 3G with 4.2.1 iOS and 05.15.04 baseband jailbreak & unloc...
:: Atom8 - Jul 10, 2011 3:22pm

Methods to Set the Samsung Galaxy S 4G to Download Mode
:: Atom8 - Jun 24, 2011 6:43pm

Saab 92x Ecopower engine ignition coils
:: TwinsAuto - Jul 16, 2008 5:34pm

Free Serial port - RS232 Data Logger
:: Atom8 - Apr 21, 2008 3:14pm

Timing chain tensioner removal on Benz 560SL 1986
:: TwinsAuto - Jan 19, 2008 4:52pm

SELECT query input must be integer
:: Atom8 - Jan 08, 2008 2:20pm

MacOSX 'smbclient' command connects to WinXP PC
:: Atom8 - Dec 15, 2007 10:26pm

Most Viewed
Most Commented
Top Rated

© 2007 - 3000 vinetop.com [ Terms & Policy :: Contact Us :: About ]