Hi all:
I am learning to use arrays through a lot of trial and error (mostly error right now :eek
Here is my challenge.
I have an array as follows:
$pShowDateArray = $_POST["showDate"];
print_r($pShowDateArray ) = Array ( [0] => 3/30/2012 [1] => 3/31/2012 [2] => 4/1/2012 )
I want to run the following. If any of the dates in the array are currently in the database for the user and a matching show ID then they redirect. They are not redirecting.
foreach ($pShowDateArray as $vAdmissionDate){
if ($stmt = mysqli_prepare($link, "SELECT userName FROM Discountees WHERE freeAdmission = ? AND userName= ? AND showID= ? ")); {
mysqli_stmt_bind_param($stmt, "sss", $vAdmissionDate, $slusername, $pShowID);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $rUsername);
mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
if (isset($rUsername)){
mysqli_close($link);
header( 'Location: http://www.mysite.com/msc/mscErrors.php?error=FA&showDate='.urlencode($vAdmissionDate)) ;
exit();
}
} // Close if ($stmt = mysqli_prepare($link, "
} // Close foreach ($pShowDateArray as $vAdmissionDate){
When I echo $vAdmissionDate I get "3/30/20123/31/20124/1/2012" so that seems to be the problem but I am just not sure.
Any help appreciated!