[SOLVED] Show only last 10 items
Moderator: General Moderators
Show only last 10 items
Hello, i was wondering, IF i made a Forum script, how would i make it so it only shows the last ...10 threads? ive always wondered this, i know you use a WHILE
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
you could do in your query
Code: Select all
<?php
$result = @mysql_query("SELECT * posts_table ORDER BY `date` DESC LIMIT 10");
?>-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Why do you always use @function?Phenom wrote:you could do in your query
Code: Select all
<?php $result = @mysql_query("SELECT * posts_table ORDER BY `date` DESC LIMIT 10"); ?>
Bad habit.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I'm sorry :*(
let me jus add this tho
let me jus add this tho
Code: Select all
<?php
$result = mysql_query("SELECT * posts_table ORDER BY `date` DESC LIMIT 10") or die("Query Error: ".mysql_error()) ;
?>Just for fun,
Will PHP be very confused and have existential problems if you do the following?
I mean we are suppressing all errors, yet we ask it to die.
Hehe, okay okay, i am sorry, that was lame...
Will PHP be very confused and have existential problems if you do the following?
Code: Select all
$result = @mysql_query("SELECT * posts_table ORDER BY `date` DESC LIMIT 10") or die("Query Error: ".mysql_error()) ;Hehe, okay okay, i am sorry, that was lame...
- evilmonkey
- Forum Regular
- Posts: 823
- Joined: Sun Oct 06, 2002 1:24 pm
- Location: Toronto, Canada
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA