An Example of Using the Old MySQL Extension : mysql_fetch_array « MySQL Database « PHP






An Example of Using the Old MySQL Extension

 
<?php

    mysql_connect("localhost", "username", "password");
    mysql_select_db("mydatabase");

    $result = mysql_query("SELECT * FROM mytable");

    while($row = mysql_fetch_array($result)) {

        foreach($row as $key=>$value) {

            echo "$key = $value<BR/>\n";

        }
    }

    mysql_free_result($result);
    mysql_close();  
?>
  
  








Related examples in the same category

1.while loop and mysql_fetch_array() function
2.Get data from database
3.mysql_fetch_array-2.php
4.mysql_fetch_array.php
5.Using timestamp with mysql
6.Retrieving and Displaying Results