mysql delete

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

parxal
New php-forum User
New php-forum User
Posts: 40
Joined: Thu Nov 07, 2002 5:58 am

mysql delete

Postby parxal » Sun Nov 10, 2002 7:05 pm

i am making a table for each row in database:
while ($row = mysql_fetch_array($result))
{
</table>
<tr>
printf("<td bgcolor=\"#FFFFFF\">Name: %s",$row["name"]);
printf("<br>Morada: %s</br>",$row["morada"]);
printf("Url: %s",$row["url"],"</td>");
</tr>
</table>
}
Is it possible, to make a button in each table, to delete that row in my database?

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Re: mysql delete

Postby Oleg Butuzov » Sun Nov 10, 2002 9:48 pm

parxal wrote:i am making a table for each row in database:
while ($row = mysql_fetch_array($result))
{
</table>
<tr>
printf("<td bgcolor="#FFFFFF">Name: %s",$row["name"]);
printf("<br>Morada: %s</br>",$row["morada"]);
printf("Url: %s",$row["url"],"</td>");
</tr>
</table>
}
Is it possible, to make a button in each table, to delete that row in my database?


YES
make a script widh will delete MYSQL records for ex del.php


while ($row = mysql_fetch_array($result))
{
</table>
<tr>
printf("<td bgcolor="#FFFFFF">Name: %s",$row["name"]);
printf("<br>Morada: %s</br>",$row["morada"]);
printf("Url: %s",$row["url"],"</td>");
echo "<td><form method=post action=dele.php target=_blank><input type=hidden value=o name=id><input type=submit calue=delete></form></td>";
</tr>
</table>
}


In del.php

Code: Select all

mysql_query(DELETE FORM `tablename` WHERE `id` = '$id");


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 9 guests