Jump to content

Deleting a mysql row


hansman

Recommended Posts

hi, i currently have all my mysql data displayed in a tabe. I would like to add a button to delete all the data in the row. Can some please assit me in doing this. Thank you in advance

 

<html>
<head>
<title>Displaying MySQL Data</title>
</head>
<body>
<p>
  <?php
$db_host="xxxxxxt"; // Host name
$db_user="xxxxxxxx"; // Mysql username
$db_pwd="xxxxxxxx"; // Mysql password
$db_name="xxxxxxxx"; // Database name




mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);

$query="select * from test_mysql";
$result=mysql_query($query);
echo "<table border=1>";
echo "<tr>";
for($i=0;$i<mysql_num_fields($result);$i++)
{
    echo "<th>";
    echo mysql_field_name($result, $i);
echo "</th>";
}

while($row=mysql_fetch_row($result))
{
    echo "<tr>";
    for($j=0;$j<$i;$j++)
    {
    echo "<td>";
    echo $row[$j];
    echo "</td>";
    }
    echo "</tr>";
}
echo "</tr>";
echo "</table>";

?>
</p>
<p><a href="http://www.xxxxx.com/insert.php">Click Here to Enter More data!</a></p>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/111666-deleting-a-mysql-row/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.