Jump to content

Saving php files with output html tables where?


eduard
 Share

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>

Edited by eduardchile
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...