Code (db.php)<?phpdefine("HOST", "localhost");define("USER", "root");define("PASSWORD", ""); define("DATABASE", "45697"); mysql_connect(HOST, USER, PASSWORD) or die("Could not connect:". mysql_error());mysql_select_db(DATABASE);?>There is few mistakein your file. It should be $result = mysql_query("SELECT * FROMtest");instead of$result = mysql_query("SELECT FROMtrasur_com_pk");andwhile ($test = mysql_fetch_array($result, MYSQL_ASSOC)) {instead ofwhile ($test = mysql_fetch_array($query)) {Code (index.php)<?phpinclude("db.php"); $result = mysql_query("SELECT * FROMtest"); while ($test = mysql_fetch_array($result, MYSQL_ASSOC)) { echo "<table>"; echo "<tbody>"; echo "<tralign='center'>"; echo"<td><fontcolor='black'>" .$test['Sno']."</font></td>"; echo"<td><fontcolor='black'>" .$test['Transporter']."</font></td>"; echo"<td><fontcolor='black'>". $test['Vehicle']. "</font></td>"; echo"<td><fontcolor='black'>". $test['Loaded_Product']. "</font></td>"; echo"<td><fontcolor='black'>". $test['Tonnage_loading_Point']. "</font></td>"; echo"<td><fontcolor='black'>" .$test['Tonnage_Unloading_Point']."</font></td>"; echo"<td><fontcolor='black'>" .$test['PSA_number']."</font></td>"; echo"<td><fontcolor='black'>" .$test['Shipment_Date_PSA']."</font></td>"; echo"<td><fontcolor='black'>" .$test['Loading_Origin']."</font></td>"; echo "</tr>"; echo "</tbody>"; echo "</table>";}?>
Comments
Leave a comment