List Info

Thread: PASSING VARIABLE FOR DELETE RECORD




PASSING VARIABLE FOR DELETE RECORD
user name
2006-04-24 11:48:05
> I made little guest book application, and options are
add, view and now I 
> want to delete a record I put the delete link on every
record, now here 
> I'm stuck how to pass the record variable to the
delete.php file.

<a href="delete.php?id=1231">delete record
#1231</a>

<?php // filename: delete.php
  if (isset($_REQUEST['id']) &&
(int)$_REQUEST['id']>0)
  {
    $id=(int)$_REQUEST['id']+0;
    $sql='delete from mytable where id='.$id;
    mysql_query($sql);
    echo "deleted ".mysql_affected_rows().
" records";
  }
?>

like this? 



Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    php-list-subscribe@yahoogroups.com
  Unsubscribe:  php-list-unsubscribe@yahoogroups.com
  List owner:   php-list-owner@yahoogroups.com

Shortcut URL to this page:
  http://groups.
yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups
.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    php-list-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 



[1]

about | contact  Other archives ( Real Estate discussion Medical topics )