Switch Statement with Operators
Posted: Mon Mar 02, 2009 3:18 pm
Hello, I need some help to sort this out ( in Red ):
when I type the command print $useridd I get the exact number of applications number in my db but when I try to use that string in the switch case with operator, that case do not work at all 
Could you please help me sort it out
thank you.
I am not an expert on phpCode: Select all
<?php require_once("library/connect.php"); $user_id = $_GET["number"]; $null = ""; $idget = ("SELECT MAX(user_id)FROM applications"); $user_idd = mysql_query($idget); $useridd = mysql_fetch_array($user_idd); $useridd = $useridd[0]; switch ($user_id) { case "$null" : echo "<p>Please enter a search...</p>"; include('pages/listbackbutton.php'); print $useridd; break; case "0" : echo "<p>No result found on the database with that number, please press back to search again.</p>"; include('pages/listbackbutton.php'); break; case"[color=#BF0000][b]$user_id > $useridd[/b][/color]" : echo "<p>No result found on the database with that number, please press back to search again.</p>"; include('pages/listbackbutton.php'); break; default : $list = "SELECT * FROM applications WHERE user_id = '$user_id'"; $applist = mysql_query($list); while($row = mysql_fetch_array($applist)) { echo "<b>Application Number</b>: {$row['user_id']}<br><br>". "<b>Nickname:</b> {$row['nickname']}<br>". "<b>Age:</b> {$row['age']}<br>". "<b>Clan:</b> {$row['clan_name']}<br>". "<b>Country:</b> {$row['country']}<br>". "<b>League:</b> {$row['league']}<br>". "<b>Member</b> Since: {$row['member_since']}<br><br>". "<b>Average Value:</b> {$row['avg_value']}<br>". "<b>Average Skills:</b> {$row['avg_skills']}<br>". "<b>Average Talent:</b> {$row['avg_talent']}<br><br>"; include('pages/listbackbutton.php'); } mysql_free_result($applist); break; } ?>
Could you please help me sort it out