Ask a question about how to judge after querying the database output! & Lt ;? Php $ mysql_server_name = 'localhost'; $ mysql_username = 'root'; $ mysql_password = '000000'; $ mysql_database = 'you '; $ conn & nb ask a question about how to query the database output for judgment!
$mysql_server_name='localhost';
$mysql_username='root';
$mysql_password='123456';
$mysql_database='you';
$conn = mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
mysql_select_db($mysql_database,$conn);
mysql_query("set names 'utf8'");
$sql = "SELECT * FROM `member` WHERE username LIKE 'xiha'";
$result = mysql_query($sql,$conn);
$row = mysql_fetch_array($result);
mysql_close($conn);
if($row['groupid'] = '1'){
$capacity = '100';
} else if($row['groupid'] = '10'){
$capacity = '1000';
} else {
exit();
}
echo $capacity;
?>
The database format is:
Uid username groupid
1 haha 1
2 xiha 10
If elseif:
The output $ capacity is always the first judgment value of 100.
If ($ row ['groupid'] = '1 '){
$ Capacity = '000000 ';
}
------ Solution --------------------
If ($ row ['groupid'] = '1 '){
One = is a value assignment.
Two are the comparison