Show all records from mysql table with PHP

Free Scripts :: PHP :: PHP and Mysql :: Show all records from mysql table with PHP

Author: Salman Javaid

Website: http://www.salman.be

  1. How to display all records from mysql table with php.
  2. Show mysql table records.
  3. List all records from mysql table.
  4. Fetch mysql table records with php.

This script displays all records from a mysql table.

Script:

$sql = mysql_query("select * from products");
while($row=mysql_fetch_array($sql)){

    // display all records
    foreach($row as $key=>$value){
        echo $value;
    }

    //display selected fields e.g "product"
    echo $row['product'] . ', ';
}

Output

nokia 6600, nokia E63, nokia 9300, nokia 9600, nokia e71,

Comments

No comments. Be the first one.

Leave a comment

Full Name*
Comments*
Security Code*

Our Partners

Getty Icons  Salman Creations
Free High Quality Images  Learn Free Languages 
Opal Hosting  R-Tech Solutions
  • Submit a Script

    Click here to submit your script.