I want to give the admin the ability to activate the user account so I have to status active and inactive
When I run my code I get 4 status
Active
Inactive
Active
Inactive
You will find here a screenshot to understand the problem I’m facing
http://i.imgur.com/2c0VcN7.png
if(isset($_GET['id_user'])){
include("conexion.php");
$rep=$db->query("select * from user WHERE id_user=" .$_GET['id_user'] );
while($l=$rep->fetch()){
echo "
"; // fin echo
}
}
?>
Answer
Your code may not have been properly formed. Try this instead:
if( isset($_GET['id_user']) ){
include("conexion.php");
$rep = $db->query( "select * from user WHERE id_user=" . $_GET['id_user'] );
// YOU ARE FETCHING A SINGLE USER... NO NEED FOR A LOOP...
// JUST GET THE ARRAY OBJECT AND USE IT DIRECTLY...
$l = $rep->fetch();
?>
No comments:
Post a Comment