SOLVED: IF statement when displaying records

hi,

I am doing a members register system and want to perform so if registration is full it produces a query setting status to ‘waiting’ else if registration is not full it performs a normal query. Eeverything works fine untill i add the extra code which performs the the waiting query.

problem is when creating the code i get a $send error… any help would mean alot…

if ($count<1) {
$query1 = "INSERT INTO members (FirstName, Surname, BadgeName, Email, Dob, Address, Mobile, SecQuest, SecAnswer, EmergencyName, EmergencyNum, Disabilities, PaidStatus) VALUES('$name','$surname','$badgename','$email','$date','$address','$mobile','$secretquest','$secretanswer','$emname','$emnum','$disab','$paidstatus')";
mysql_query($query1) or die(mysql_error()); 
  
$query2 = "UPDATE members SET PaidStatus = 'waiting' WHERE badgename = '$badgename'";
mysql_query($query2) or die(mysql_error()); 

echo "Thank you for registering but Kitacon is currently full. <br>";
echo "You have been put onto the waiting list and we will let you know if spaces are available.<br>";  
echo "your ID number is.... "; 
 
$result = mysql_query("SELECT ID FROM members where BadgeName = '$badgename'") or die(mysql_error()); 

// Print out the contents of the entry  
 while($row = mysql_fetch_array( $result )) 
echo $row['ID'];
 echo "<a href="../index.php">Home</a>";
 
 }else{
 
 //Insertion of data 
 $query = "INSERT INTO members (FirstName, Surname, BadgeName, Email, Dob, Address, Mobile, SecQuest, SecAnswer, EmergencyName, EmergencyNum, Disabilities, PaidStatus) VALUES('$name','$surname','$badgename','$email','$date','$address','$mobile','$secretquest','$secretanswer','$emname','$emnum','$disab','$paidstatus')"; 
 mysql_query($query) or die(mysql_error()); 
 echo "The username has been successfully registered. <br>";
 echo "your ID number is.... "; 
 $result = mysql_query("SELECT ID FROM members where BadgeName = '$badgename'") or die(mysql_error()); 
// Print out the contents of the entry  
 while($row = mysql_fetch_array( $result )) 
 echo $row['ID'];
 echo "<br><br>";
 echo "Please put the ID with your badgename on the back of the cheque and sent it to..<br><br>";
 echo "Insert address here <br><br>";
 echo "<a href="../index.php">Home</a>";
}
}
}
?> 

What’s the $send error? Copy-paste it here so we know what to look for.
Other than that, have you tried debugging, i.e. using echo statements to make sure your variables are what your expect them to be?

i looked at the code over and over and found out a missing bracket was needed. so its working now. sorry for the late reply.

Sponsor our Newsletter | Privacy Policy | Terms of Service