php mysql_fetch_array() function - how to use mysql_fetch_array() function in php

php mysql_fetch_array() function - how to use mysql_fetch_array() function in php


mysql_fetch_arrayFunction.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php mysql_fetch_array() function - how to use mysql_fetch_array() function in php</title>
</head>

<body>
    <h2 style="color:OrangeRed; font-style:italic">php mysql_fetch_array() function example: how to use</h2>
    <hr width="475" align="left" color="Orange" />
    <br />

<?php 
 $link = mysql_connect("localhost","root","") or die("could not connect:" . mysql_error());
 mysql_select_db("phpexamples",$link) or die(mysql_error());
 
 $query= "select UserName from User";
 $results= mysql_query($query) or die(mysql_error());
 
 while ($row = mysql_fetch_array($results)){
  extract($row);
  echo "<h2 style=Color:Green>";
   echo $UserName;
  echo "</h2>";
  }
?>

</body>
</html>