I am trying to get value multiple value fetch from MySQL array and check array key exists or not.
I have two different table booking_info
and ticket_details
If both id is same the get the value from ticket_details
function getSeatInfo()
{
global $getseatinfo;
$id = 1;
$sql = "SELECT id FROM booking_info WHERE id = '". $id . "'";
$sqlr = "SELECT * FROM ticket_details WHERE id = '". $$sql . "'";
$res = mysql_query($sqlr);
$c=0;
while ($a_row = mysql_fetch_array($res)) {
$getseatinfo[$c]["id"] = $a_row["id"];
$getseatinfo[$c]["seat_number"] = $a_row["seat_number"];
$c++;
}
return $getseatinfo;
}
and check the value if exists or not
global $getseatinfo;
$values=array('A1','A2','A3','B1','B2','B3');
if (array_key_exists($values,$getseatinfo)) {
echo "Key exists!";
} else {
echo "Key does not exist!";
}