Thread: php and mysql
View Single Post
Old 04-22-2008, 05:18 AM   #1 (permalink)
kororo203
The Wanderer
 
Join Date: Apr 2008
Posts: 15
Thanks: 0
kororo203 is on a distinguished road
Default php and mysql

i think it's a bit off topic here vut i guess i'll try..

hm... the situation is that im using mysql for the database...

lets say i have a table...

id name addr
1 xxx vvv
2 sss eee
3 qqq rrr

now my web program uses to add edit and delete data in the database

lets say that i have delete record 1 and insert a new record...


id name addr
4 ooo ppp
2 sss eee
3 qqq rrr

here is my code"


mysql_connect('localhost','','') or die(mysql_error());
mysql_select_db('test') or die(mysql_error());

function delete()
{

}

$sql=mysql_query("SELECT * FROM weh");

echo '<table cellpadding = 8 cellspacing = 0>';
while ($row=mysql_fetch_assoc($sql)) {


echo'<tr>
<td>'.
$row['id'].'
</td>
<td>'.
$row['name'].'
</td>
<td>'.
$row['addr'].'
</td>
<td>
<form>
<input type = "button" value="delete" id = "" name="delete" style=" width:60 px;height:20px"onclick = ""/>
</td>
<td>
<input type= "button" value="edit" id = "" name = "edit" style=" width:60 px;height:20px"onclick = ""/>
</td>
</form>';
$cdel=$cdel+1;
$cedit=$cedit+1;}
echo '</table>';
?>


got the problem up in the input button since i can't figure it out how to determine which data to delete...
hope you understand my explanation thanx...
kororo203 is offline  
Reply With Quote