$table_name = "my_table"; $timestamp_field = "date_posted"; /* or something similar */ $max_records = 5;
$sql = sprintf("SELECT * FROM %s ORDER BY %s DESC LIMIT %d", $table_name, $timestamp_field, $max_records): $result = mysql_query($sql); /* ... */ Dave Carrera <[EMAIL PROTECTED]> wrote in message 000601c1aa2c$84eb4a60$f94a27d9@authorised">news:000601c1aa2c$84eb4a60$f94a27d9@authorised... > Hi All > > I know this has been covered here before but can someone please remind > me how to selct just the 5 latest records in my db and show them in list > form. > > Just like phpbuilder.com dose > > I thank you in advance for repeating this information. > > Dave C :-) > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]