Jump to content

Saving php files with output html tables where?


eduard

Recommended Posts

Where do I have to save this file will it show html tables on my website and where do I have to save a list of the persons?Code:<html><body><?php$con = mysql_connect('localhost','root','root'); if (!$con) { die('Could not connect: ' . mysql_error();mysql_select_db("my_db", $con);$result = mysql_query("SELECT * FROM Persons");echo "<table border = '1'><tr><th>Firstname</th><th>Lastname</th></tr>";while ($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row[ 'FirstName'] . "</td>"; echo "<td>" . $row[ 'LastName'] . "</td>"; echo "</tr>"; }echo "</table>";mysql_close($con);?></body></html>

Link to comment
Share on other sites

The list is saved in the database.The PHP file can be saved anywhere in your web host. Make sure you give the proper connection information for the database.
Thanks very much!
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...