eduard Posted February 25, 2011 Share Posted February 25, 2011 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 More sharing options...
Ingolme Posted February 25, 2011 Share Posted February 25, 2011 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. Link to comment Share on other sites More sharing options...
Fmdpa Posted February 25, 2011 Share Posted February 25, 2011 The table is outputted directly as HTML. It will display on your page. Link to comment Share on other sites More sharing options...
eduard Posted February 25, 2011 Author Share Posted February 25, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.