PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?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;
}
?>
I am not an expert on php 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
If you want to test an expression then you should use an if/elseif, it's not really practical to use a switch, though it is possible in the following manner:
mickeyunderscore wrote:If you want to test an expression then you should use an if/elseif, it's not really practical to use a switch, though it is possible in the following manner: