<h1>MySQL Test Code Results</h1> |
<p><table border="1"> |
<tr> |
<td>ID</td> |
<td>First Name</td> |
<td>Last Name</td> |
</tr> |
|
<?php |
|
// Configuration Information and Definitions |
|
$mysql_host = 'MySQL Server Name'; |
$mysql_user = 'DB Login'; |
$mysql_pass = 'DB Password'; |
$mysql_db = 'DB Name'; |
$query = 'SELECT * from table1'; |
|
$con = mysqli_connect($mysql_host, $mysql_user, $mysql_pass) or die("Connection to MySQL-server failed!"); |
|
mysqli_select_db($con, $mysql_db) or die("Selection of database $mysql_db failed!"); |
|
$result = mysqli_query($con, $query) or die("Invalid Query, " . mysql_error()); |
|
while( list( $pkid, $fname, $lname ) = mysqli_fetch_row($result) ) { |
printf("<tr><td>%d</td><td>%s</td><td>%s</td></tr>", $pkid, $fname, $lname); |
} |
|
?> |
</table> |
<p /> |
<b>End MySQL Test Code Results</b> |
Article ID: 167, Created: July 25, 2012 at 12:38 AM, Modified: May 29, 2016 at 5:48 AM