Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old July 25th, 2003, 09:59 AM
kohsh kohsh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Laun,TAS, AUS
Posts: 21 kohsh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to kohsh Send a message via Yahoo to kohsh
Need help with Mysql statement

This is a part of my code, how to add selection criteria into the select * from table limit 5,5 where bookid<30; There are hundreds of records in the table which I only want those match the selection criteria.

The program can run properly without the "where" at the end of SQL statement.

$query = "SELECT * FROM booklist LIMIT " . $start . ", ".$_SESSION["pageno"]." where bookid < 30 ";

Does anybody know whether can put where behind the LIMIT or not?? Please help, thanks.

Reply With Quote
  #2  
Old July 25th, 2003, 11:07 AM
bakertrg's Avatar
bakertrg bakertrg is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Scottsdale AZ, US
Posts: 2,253 bakertrg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 45 sec
Reputation Power: 4
Send a message via Yahoo to bakertrg
RE: Need help with Mysql statement

Are you trying to do pagination? The LIMIT goes at the end, and what you need to do is find a way to pass the limit values (most likely in a query string as part of the URL) so you can return x number of values starting with record y.


Reply With Quote
  #3  
Old July 25th, 2003, 11:47 AM
kohsh kohsh is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Laun,TAS, AUS
Posts: 21 kohsh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to kohsh Send a message via Yahoo to kohsh
RE: Need help with Mysql statement

Thanks bakertrg,

I have found the solution for the statement, actually I should write in this way:

SELECT * from table where bookid<30 limit 10,10;


Anyway, thanks.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Need help with Mysql statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway