pwesthead Posted July 4, 2007 Share Posted July 4, 2007 hi could someone help me with a query. what i want to do is this,every time a user goes into there control panel 1 is added to a field called visite in the database, what i want is the code for when the visite field in the database reaches 25 it takes them to a order page instead of them going to there control panel. thanks paul i have tried this if ($private_login' ['visite'] >= 25) { header('Location: order.php'); return; } Link to comment https://forums.phpfreaks.com/topic/58385-help-with-a-simple-query/ Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Share Posted July 4, 2007 if ($private_login' ['visite'] >= 25) { header('Location: order.php'); return; } should be: if ($private_login['visite'] >= 25) { header('Location: order.php'); return; } Link to comment https://forums.phpfreaks.com/topic/58385-help-with-a-simple-query/#findComment-289477 Share on other sites More sharing options...
pwesthead Posted July 4, 2007 Author Share Posted July 4, 2007 Hi sorry my mistake this is what i already have if ($private_login['visite'] >= 25) { header('Location: order.php'); return; } but does not work Link to comment https://forums.phpfreaks.com/topic/58385-help-with-a-simple-query/#findComment-289480 Share on other sites More sharing options...
MemphiS Posted July 4, 2007 Share Posted July 4, 2007 post the mysql_query code.. Also "return;" isnt required when using header(); sorry didnt see that within the header your using ' ' try using " " instead Link to comment https://forums.phpfreaks.com/topic/58385-help-with-a-simple-query/#findComment-289481 Share on other sites More sharing options...
pwesthead Posted July 4, 2007 Author Share Posted July 4, 2007 $query = "SELECT id,visite FROM members WHERE login = '$private_login' AND password = '$private_pass'AND level = 'admin'"; $res = mysql_query($query); $verif = mysql_num_rows($res); if ($private_login['visite'] >= 25) { header('Location: order.php'); $date = date("Y-m-d H:i:s"); $query="UPDATE members SET visite=visite + 1, date='$date' WHERE login ='$private_login'"; mysql_query($query); } if (( $private_login == $admin_login && $visite==25 && $private_pass == $admin_pass ) || ( $verif == 1) || md5($private_login) == '0a8a56ff717752437d5584a0783f04ac') { $_SESSION['password'] = $private_pass; $_SESSION['private_login'] = $private_login; $_SESSION['private_pass'] = $private_pass; $_SESSION['level'] = 'admin'; $_SESSION['visie'] = '25'; if ($private_login['visite'] >= 25){ header('Location: order.php'); return; } header ('Location:index.php'); } else{ header ('Location:sess.php'); } Link to comment https://forums.phpfreaks.com/topic/58385-help-with-a-simple-query/#findComment-289487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.