Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php$con = mysql_connect("localhost", "USERNAME", "PASSWORD");
if (!$con) {
die('Could Not Connect: ' . mysql_error());
}
mysql_select_db("DB_NAME", $con);
$result = mysql_query("SELECT firstname, lastname, email, phone, mobile, address_1, address_2, city, zipcode, country, state FROM TABLE_NAME");
echo "
<table border='1'>
<tr>
<th>S. NO. </th>
<th>First Name</th>
<th>Last Name</th>
<th>Email Address</th>
<th>Phone No.</th>
<th>Mobile No.</th>
<th>Address</th>
<th>City & Zip</th>
<th>State & Country</th>
<th> Delete Entry</th>
</tr>";
$i = 1;
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $i . "</td>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['lastname'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['phone'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "<td>" . $row['address_1'] . ", " . $row['address_2'] . "</td>";
echo "<td>" . $row['city'] . ", " . $row['zipcode'] . "</td>";
echo "<td>" . $row['state'] . ", " . $row['country'] . "</td>";
echo "<input type='hidden' name='mobile' value='$row[mobile]' />";
echo "<td>" . "<input type='submit' name='submit' value='Delete'/>" . "</td>";
echo "</tr>";
$i++;
}
echo "</table>";
mysql_close($con);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.