I'm new with PHP. I have a problem with delete function.
Everytime i delete a data from database I have to refresh to see the result. So how to solve this problem? And is dividing all the function(add, delete, update) in separated file can overcome this?
Any help would be very grateful.
Thank you.
(delete function)
if(empty($userid)) error_message('Empty User ID!');
$link_id = db_connect($default_dbname);
if(!$link_id) error_message(sql_error());
//*******SQLstmt-delete chosen data*****
$query = "DELETE FROM $user_tablename WHERE userid = '$userid'";
$result = mysql_query($query);
if(!$result) error_message(sql_error());
$num_rows = mysql_affected_rows($link_id);
if($num_rows != 1) error_message("No such user: $userid");
user_message("All records regarding $userid have been delete!");
php_databases@p2p.wrox.com
html>
<body>