Computer Science Canada Need help with PHP/MySQL |
Author: | Numbah51 [ Mon Nov 06, 2006 12:04 am ] | ||
Post subject: | Need help with PHP/MySQL | ||
I have a list of things in my database, numbered under the column 'Number'. What i'm trying to do is to display 5. I want it to work so that the page will be like whatever.php?start=0 and it will display videos 56-60 (if there is 60 videos in the database) and if start=1 then it will display videos 51-55. The query i attemped and failed at using was:
|
Author: | wtd [ Mon Nov 06, 2006 8:40 am ] | ||
Post subject: | |||
Perhaps:
Is a typo? |
Author: | rdrake [ Mon Nov 06, 2006 8:43 am ] |
Post subject: | |
Just a few nitpicks... $x is not a very meaningful variable name. Also, the value of $x should be sanitized. Remember not to trust anything that comes from outside sources. How exactly is this failing? Can you give is an example? Let's say you set start=10. |
Author: | Numbah51 [ Mon Nov 06, 2006 9:46 am ] | ||||
Post subject: | |||||
wtd wrote: Perhaps:
Is a typo? i just typed it wrong when i typed it here. It should be
And it doesn't work like it gives a SQL error. Even when i just put $x=0 it doesn't work. |
Author: | rdrake [ Mon Nov 06, 2006 9:55 am ] | ||||
Post subject: | |||||
Numbah51 wrote: wtd wrote: Perhaps:
Is a typo? i just typed it wrong when i typed it here. It should be
And it doesn't work like it gives a SQL error. Even when i just put $x=0 it doesn't work. |
Author: | Numbah51 [ Mon Nov 06, 2006 10:01 am ] |
Post subject: | |
Unfortunately I'm at school right now, i'll post it when i get home. Thanks for your time so far btw. |
Author: | octopi [ Mon Nov 06, 2006 1:09 pm ] | ||||
Post subject: | |||||
I haven't looked at your code to determine if thers typos or not, but a more common way to do this is as follows:
you can change ASC to DESC to switch between ascending, and descending results. |
Author: | Numbah51 [ Mon Nov 06, 2006 11:44 pm ] |
Post subject: | |
omg thank you that works perfectly! |