If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > PAGINATION LIMIT and OFFSET ERROR

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-29-11, 10:32
madbaho madbaho is offline
Registered User
 
Join Date: Sep 2011
Posts: 1
PAGINATION LIMIT and OFFSET ERROR

Howdy All!

I have been working on a table selector with pagination using PHP. I can get it to work with mysql but when I change query and methods to postgres my query throws an ERROR.
Code:
Warning: pg_query(): Query failed: ERROR: LIMIT #,# syntax is not supported LINE 1: ...le_name, file_path FROM videos ORDER BY file_name LIMIT 0, 1... ^ HINT: Use separate LIMIT and OFFSET clauses. in /var/www/its/VersionC/Pagination/test2.php on line 14 ERROR: queryMysql wont query to database!
the query I have implemented.

PHP Code:
$sql "SELECT file_name, file_path FROM videos ".
      
"ORDER BY file_name LIMIT $from$max_results"
I do know when writing queries for pagination MySQL uses LIMIT and Postgres uses LIMIT and OFFSET. When I place a OFFSET in query it basically throws same error as above. I have checked and double checked my functions and I feel highly my issue is with the query itself. If you have any recommendations or any way to help me fix this issue it would be beyond greatly appreciated. This is a big issue for me and I would love to learn and understand what is wrong and why for future. After my search for an answer I learned this is a on going problem for people trying to paginate with postgres using php to use a table selector.

Much Thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On