PHP/SQL: How to show data from a table along with edit and delete buttons?

taz

New member
Here is the code I am using:

<?php
$con = mysql_connect("localhost","tworldpk","");
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>Fullname</th>
<th>Email</th>
<th>Country</th>
<th>City</th>
<th>Username</th>
<th>Password</th>
<th>Job</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['FullName'] . "</td>";
echo "<td>" . $row['Email'] . "</td>";
echo "<td>" . $row['Country'] . "</td>";
echo "<td>" . $row['City'] . "</td>";
echo "<td>" . $row['Username'] . "</td>";
echo "<td>" . $row['Password'] . "</td>";
echo "<td>" . $row['Job'] . "</td>";
echo "</tr>";
}
echo "</table>";

mysql_close($con);
?>
 
Back
Top