Jump to content


Photo

Simple Question about Delete Query


  • Please log in to reply
2 replies to this topic

#1 ashrafzia

ashrafzia
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 25 September 2006 - 05:30 PM

I do know how to exectue the delete query but i just wanna clear my concept.
I have a table of Users, having user id's.
I have a button view all records which is used for displaying records from DB.
Now i want that each record should have an image named Delete infront of it and when i mouseover on that image the userid should automatically came on it and by clicking that image the delete query should execute.
And same to Edit Record

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 25 September 2006 - 05:33 PM

Something like this should do it:
<?php
//...
while($u = mysql_fetch_assoc($result))
{
	echo <<<EOF
<p>{$u['username']} <button type="button" onclick="this.href='http://example.com/admin/index.php?act=members&func=delete&id={$u['id']}'">Delete</button></p>

EOF;
}
//...
?>


#3 ashrafzia

ashrafzia
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 25 September 2006 - 05:50 PM

<?php
//...
while($u = mysql_fetch_assoc($result))
{
	echo <<<EOF
<p>{$u['username']} <button type="button" onclick="this.href='http://example.com/admin/index.php?act=members&func=delete&id={$u['id']}'">Delete</button></p>

EOF;
}
//...
?>


Would you kindly give some explanation ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users