简体   繁体   中英

how to update specific id to accept or deny users

approve.php :

<?php
include('lock.php'); 
include('config.php');

$querychange = mysql_query("UPDATE booking_members SET status='Approved'");
echo 'The Request has been approved. You may now go <a href="admin-panel.php">Back to the previous page</a>';
?>

How can I update an id to display status approve?

Here is my admin-panel.php :

$req = mysql_query('select id, email, start_date, end_date, time_event,
                    time_submitted,payment_method, status from booking_members');
while($dnn = mysql_fetch_array($req)){?>

Set an $id variable and then pass that to the query with a WHERE clause. On the button on the first page, you would pass the variable via an ?id= . This would look like:

First page code:

<td class="left"> <a href="approve.php?id=<?php echo $dnn['id']; ?>">Approve</a> </td>

Then approve.php :

// set id
$id = $_GET["id"];
$querychange = mysql_query("UPDATE booking_members SET status='Approved' WHERE id = '$id'");

I had a similar problem... the thing is there is no approved column. there is an authorised (spelled how it is used in DNN)column. Here is my select statement to show approved members for my site:

 SELECT
 u.UserName,
 upd.FirstName,
 upd.LastName,
 upd.unit as Numerical,
 Upd.Street
 FROM 
 dbo.Users AS u  LEFT OUTER JOIN
 (SELECT up.UserID, 
 MAX(CASE WHEN ppd.PropertyName = 'FirstName' THEN up.PropertyValue ELSE '' END)
 AS FirstName, MAX(CASE WHEN ppd.PropertyName = 'LastName' THEN up.PropertyValue 
 '' END)
 AS LastName,
 MAX(CASE WHEN ppd.PropertyName = 'Unit' THEN up.PropertyValue ELSE '' END)
 AS unit,
 MAX(CASE WHEN ppd.PropertyName = 'Street' THEN up.PropertyValue ELSE '' END)
 AS Street  
 FROM   
 dbo.UserProfile AS up INNER JOIN
 dbo.ProfilePropertyDefinition AS ppd ON up.PropertyDefinitionID =           
 ppd.PropertyDefinitionID
 and ppd.PortalID = 0 Group By up.UserID)
 as upd on u.UserID = upd.UserID Join dbo.UserPortals  on UserPortals.Userid =      
 U.Userid where Authorised='True'
 and  u.userid>16  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM