redarrow Posted August 23, 2006 Share Posted August 23, 2006 can someone help the person with the paypal payment and activated does not seem to work please help cheers.[code]<?phpif(($name)&&($password)){$query="select * from members where name='$name' and password='$password'";$result=mysql_query($query);while($record=mysql_fetch_assoc($result)){if(mysql_num_rows($result)==1){$id=$record['id'];$password=$record['password'];$name=$record['name'];session_register('name');session_register('password');session_register('id');if($record['email_activated']=="yes"){header("location: payment_plan.php");exit;}elseif(($record['email_activated']=="yes")&&($record['paypal_payment_payed']=="yes")){header("location: members_area.php");exit;} } } }?>[/code] Link to comment https://forums.phpfreaks.com/topic/18374-solvedpaypal-and-activated-not-working-cheers/ Share on other sites More sharing options...
.josh Posted August 23, 2006 Share Posted August 23, 2006 well first off, youre elseif will never be executed, because the only way it will be true is if the first argument is true, in which case your original if statement would have been true and that would have executed instead of the elseif. 2nd, if you are only expecting and wanting to execute code based on 1 row returned, ditch the while loop, and simply do your fetch_assoc inside your if statement. 3rd, assigning the values of $record to your variables and then registering them is redundant, and if i'm not mistaken, session_register is depreciated. instead, you should simply do [b]$_SESSION['name'] = $record['name'];[/b]after all that, you need to be more specific when you say "it doesn't work." what are you wanting it to do? Link to comment https://forums.phpfreaks.com/topic/18374-solvedpaypal-and-activated-not-working-cheers/#findComment-79009 Share on other sites More sharing options...
redarrow Posted August 23, 2006 Author Share Posted August 23, 2006 i want this connditionhow can i get both condition to work one or the other then cheers.if($record['email_activated']=="yes"){header("location: payment_plan.php");exit;}elseif(($record['email_activated']=="yes")&&($record['paypal_payment_payed']=="yes")){header("location: members_area.php");exit; Link to comment https://forums.phpfreaks.com/topic/18374-solvedpaypal-and-activated-not-working-cheers/#findComment-79010 Share on other sites More sharing options...
.josh Posted August 23, 2006 Share Posted August 23, 2006 okay i think what you are wanting to do is this:[code]if ($record['email_activated']=="yes") { if ($record['paypal_payment_payed']=="yes") { header("location: members_area.php"); exit; } else { header("location: payment_plan.php"); exit; }}[/code] Link to comment https://forums.phpfreaks.com/topic/18374-solvedpaypal-and-activated-not-working-cheers/#findComment-79012 Share on other sites More sharing options...
redarrow Posted August 23, 2006 Author Share Posted August 23, 2006 thank you solved Link to comment https://forums.phpfreaks.com/topic/18374-solvedpaypal-and-activated-not-working-cheers/#findComment-79014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.