eduard Posted February 25, 2011 Report Share Posted February 25, 2011 (edited) 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> Edited February 25, 2011 by eduardchile Link to comment Share on other sites More sharing options...
Ingolme Posted February 25, 2011 Report 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 Report 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 Report 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
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now