|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey everyone,
I webmaster a few sites online (some of you may be famliar with Aldera.net) and I'm working on another one now called Desktop Angels. I have created my MySQL database and worked on the front end PHP for a while.. You can see what I've done so far on this page: http://www.desktopangels.net/models.php Now, all I've really done on this page is write a script that pulls wallpapers from the MySQL database and display them on the page the way I want - four rows of three wallpapers... next thing I am working on, and need help with, is how can I limit the number of wallpapers per page to 12, then display the next 12 on the next page, and so on... I don't understand how to do that.. I think it's a function in MySQL called LIMIT, yes? Something like that? Basically, the website has five sections for wallpapers: Art, Angels, Models, Celelbrities, and Unknowns. ... in fact, I want to design it almost identically to desktopgirls.com (great site). Can anyone help me with this 12 per page thing? I also want links on the page to the NEXT PAGE and PREVIOUS PAGE.. Thanks, -Doc |
|
#2
|
|||
|
|||
|
You can limit the number of records in the result set with the LIMIT keyword - this keyword takes two parameters, which specify the row to start with and the number of rows to display. So the query
Code:
SELECT * FROM videos LIMIT 2,2 would return rows 3 and 4 from the result set. Ps. Great site so far, i've bookmarked it ![]() |
|
#3
|
|||
|
|||
|
oh ok.. so in the code LIMIT 2,2 means start at row two and display two rows? ... why then would it display rows 3 and 4 rather than rows 2 and 3?
Ok I have another question.. when I coded that page, I put somethign like SELECT * FROM models.. and I named the page models.php. Well, this way I can't use this page for the other sections (like celebrities, art, unknowns, etc..) How can I remove the "models" from 'SELECT * FROM models' so that this page can be used for all the other sections too? If you don't understand what I mean, take a look at desktopgirls.com. (Great site!) They use a page called /list_thumbs.asp to display all their thumbnails... they use this page for all their categories (models, art, celebs, etc..) and there is a string in the url identifying which category you're looking at.. like: /list_thumbs.asp?categoryID=2 ... so do I do something like this? SELECT * FROM $category and then identify $category in a string? Is that how this is done? Thanks a lot for the help and for the comments on the site! -Doc |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > PHP/MySQL - simple questions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|