Pages

how to get the first 500 record from table in php mysql mysql

Friday, 28 March 2014

we are geting first 500 record form table using php and mysql

mysql_connect("hostname", "username","")
mysql_select_db("databasename");

$sql = "SELECT * FROM table ORDER BY id DESC LIMIT 50";
$result = mysql_query($sql);

  while ($query = mysql_fetch_assoc($result))



    {

    echo "$query[fieldname1] $query[fieldname2] <br/>";
}
 

Most Reading