Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Trouble updating value of variable for a placeholder

by peppiv (Curate)
on Jun 14, 2002 at 17:05 UTC ( #174634=note: print w/replies, xml ) Need Help??


in reply to Re: Trouble updating value of variable for a placeholder
in thread Trouble updating value of variable for a placeholder

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
  • Comment on Re: Re: Trouble updating value of variable for a placeholder

Replies are listed 'Best First'.
Re: Re: Re: Trouble updating value of variable for a placeholder
by stajich (Chaplain) on Jun 14, 2002 at 18:06 UTC
    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
Node Status?
node history
Node Type: note [id://174634]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-05-26 05:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?