php method to determine whether the query result is empty: 1. Use the sql method, the code is [select count(people) c from people where people='Lele']; 2. Use the php method, the code is [$p=$_POST['p'];].
[Related learning recommendations:php programming(video)]
php method to determine whether the query result is empty:
1,
select count(people) c from people where people='乐乐'
The above sql is the principle
2,
php utilization code
query("select count(people) c from people where people='".$p."'"); foreach($ps as $s){ if ($s['c']=='0'){ echo "用户可用"; }else{ echo "此用户名已存在"; } } ?>
If you want to learn more about programming, please pay attention to thephp trainingcolumn!
The above is the detailed content of How to determine whether the query result is empty in php. For more information, please follow other related articles on the PHP Chinese website!