|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
How do I use LIMIT to limit results?
I've not solved my paging problem yet
but would like to try using LIMIT. Has anyone an idea of how the syntax would go? i.e. mySQL = "SLELECT * FROM TableName WHERE ColumnName = ' " & thisquery & " ' " I've tried : LIMIT ' " & requestlimit & " ' , '5' " where requestlimit would come from the querystring; but I cannot get the syntax so it's liked. Any ideas? Johnie |
|
#2
|
|||
|
|||
|
Hi Johnie,
You use limit in conjunction with 1 or 2 numbers. If you use 1 number like this: select * from myTable limit 5; then MySQL will grab the first 5 results from the table. However, if you use if like this: select * from myTable limit 5,5; then MySQL will grab 5 results, starting from record number 5. So it's limit [startPos], [numberOfRecords] Hope this helps ![]() |
|
#3
|
|||
|
|||
|
I've tried this but ..
Thanks, but any idea of the syntax that's required?
I've tried : strNamesrch = "SELECT * FROM Traders WHERE tName LIKE '%" & namesearchterm & "%' Limit [' " & Curpage & " '],[3] ORDER BY tName ASC" Also Limit [' & Curpage & '],[3] Limit '[ " & Curpage & " '']',[3] Limit '[ " & Curpage & " '],[3]' Limit [ " & Curpage & " ],[3] etc. Whichever way I try, it picks up the number value of Curpage; but I get the same error message every time .. ADODB.Recordset.1 error '80004005' SQLState: 42000 Native Error Code: 1064 [TCX][MyODBC]You have an error in your SQL syntax near ''3'`,`3` ' at line 1 I need to feed this first value in as a variable from the querystring in order to page through results. But any idea of the syntax needed to give it the right figure for successive pages? Also, how would you get the 'nect' link to stop generating when the matching records have run out? PageCount doesn't seem to gather any value higher than one for me on this site. Johnie |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > How do I use LIMIT to limit results? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|