Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Trouble updating value of variable for a placeholder

by stajich (Chaplain)
on Jun 14, 2002 at 16:50 UTC ( [id://174625]=note: print w/replies, xml ) Need Help??


in reply to Trouble updating value of variable for a placeholder

Improper SQL there is tripping you up - pretty sure you don't want the ... LIMIT > ?, 10 in your code - you just want the placeholder so chg to  ... LIMIT > ?.

Replies are listed 'Best First'.
Re: Re: Trouble updating value of variable for a placeholder
by peppiv (Curate) on Jun 14, 2002 at 17:05 UTC
    Thanks for the help. But LIMIT ?,10 should work.

    The first value in LIMIT is the offset - which result to start returning from (starts at 0) And the second value is the amount of rows to return.

    If the placeholder value equaled 2 then the statement LIMIT 2,10 would yield results 3 - 13. I've put a static value in the LIMIT and it worked correctly.

    peppiv
      Clearly I was being dumb, sorry that I posted without checking. Lesson learned about how LIMIT should work now.

      There must be something wrong somewhere else as I was actually able to make the following work just fine on mysql with prepare and execute stmts. Try printing out your '$limit' string and/or doing a validate if( $limit !~ /^\d+$/) { die("limit was '$limit' which is NaN"); }

      "SELECT * FROM tablea WHERE id > ? LIMIT ?,?" "SELECT * FROM tablea LIMIT ?,?" "SELECT * FROM tablea LIMIT ?,10" "SELECT id from tablea LIMIT ?,10" "SELECT * from tablea ORDER BY id LIMIT ?,10"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://174625]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-19 21:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found