Reference table columns by index : Table Column : MySQL Database PHP Source Code


PHP Source Code » MySQL Database » Table Column »

 

Reference table columns by index




<html>
  <body>
  <?php
  $host="mysql153.secureserver.net";
  $uname="navioo";
  $pass="password";
  $database="navioo";
  $tablename="Employee";
 
  $connection= mysql_connect ($host, $uname, $passor die ("<br>Database connection failed! <br>");
  $result=mysql_select_db ($databaseor die ("<br>Database could not be selected<br>");
  $query = "SELECT * from Employee";
  $result = mysql_query ($query);
  echo "<table>";
  echo "<tr";
  echo " <td> <center><b>ID    </b></center></td>n";
  echo " <td> <center><b>First Name   </b></center></td>n";
  echo " <td> <center><b>Last Name</b></center></td>n";
  echo " </tr>n";
  while ($row=mysql_fetch_row ($result))
  {
  echo " <tr>n";
  echo "   <td>$row[0] </td>n";
  echo "   <td>$row[1] </td>n";
  echo "   <td>$row[2] </td>n";
  echo " </tr>n";

  }
  echo "</table>n";
  ?>
  </body>
  </html>
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo MySQL Database
» Table Column