I am working on a project that users apply for events. The pertinent code I have now is as follows:
<? if(in_array($u_id, $app)){ ?>
<td>Unapply:</td>
<td><a href="event_unapply.php?event_id=<?=$e_id; ?>">Unapply</a></td>
<? } else{ ?>
<td>Apply:</td>
<td><a href="event_apply.php?event_id=<?=$e_id; ?>">Apply!</a></td>
<? }?>
Now if a user is applied, the print_r of the array looks like:
Array ( [0] => Array ( [id] => 3 [Userid] => 1 ) )
$u_id matches the [Userid] in the event but it always goes to the else statement.
I tried doing $app['0']
but then every time the user is not applied for an event, it returns a PHP error.
Does anyone have an idea to make it so it would work?