Help With editting and deleting form

Posted on 16th Feb 2014 by admin

Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.png
This table prints the titles of entries from a table in a database.. The code that i use for this table is this :
Code: [Select]<!--Table For Deleting and Updating -->





<p align="center"><font color="#1569C7">DeleteOrEdit(</font><font color="red">Security Projects & Thoughts Section</font><font color="#1569C7">);</font></p>

<table align="center" border="2" bordercolor="green" cellspacing="0">

<!--First row with title delete and edit-->
<tr>
<td><font color="#F87217">Title:</td>
<td><font color="#F87217">Delete();</font></td>
<td><font color="#F87217">Edit();</font></td>
</tr>

<?php

$query = 'SELECT title FROM site_entries ORDER BY date_entered DESC';

if ($r = mysql_query($query)){

while ($row = mysql_fetch_array($r)){
print "<tr>
<td><font color="#8BB381">{$row['title']}</td>
<td><form method="post" name="sub_del"><input type="submit" value="Delete();"></form></td>
<td><form method="post" name="sub_edt"><input type="submit" value="Edit();"></form></td>
</tr> ";

}
}else{
die('<p>Could not retrive the data brcause:<b>' . mysql_error .'</b> The query was $query.</p>');

}


mysql_close();


?>

</table>
Its simple...till here...

Now i stack on how to make the script that will delete the registers of the database...I can think something with id column but i can't make it true...:s I want you to help me giving me ideas on how to make this or any other idea on how to create an delete/edit page...If you think that i start it with a wrong way please tell me

The table name is site_entries and its columns are id , title , entry , date_entered

Thanks

Other forums