Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/58.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
条件以查看是否有MySQL查询的结果?_Mysql - Fatal编程技术网

条件以查看是否有MySQL查询的结果?

条件以查看是否有MySQL查询的结果?,mysql,Mysql,我想做一个条件,如果有结果,它将返回true。我该怎么做 $result = mysql_query("SELECT * FROM `Groups` WHERE `City` = '$city2' LIMIT 12 OFFSET 6"); if (the condition) { while($row = mysql_fetch_array( $result )) { ?> <a href="/?ciudad=<?php echo $city; ?>&

我想做一个条件,如果有结果,它将返回true。我该怎么做

$result = mysql_query("SELECT * FROM `Groups` WHERE `City` = '$city2' LIMIT 12 OFFSET 6");


if (the condition) {

while($row = mysql_fetch_array( $result )) { ?>
    <a href="/?ciudad=<?php echo $city; ?>&colegio=<?php echo $row['Group']; ?>" class="<?php if ($group == $row['Group']) { echo "selected"; } ?>"><?php echo $row['Group']; ?></a>  <?
    }   
}
$result=mysql\u查询(“从'Groups'中选择*,其中'City`='$city2'限制12偏移量6”);
如果(条件){
而($row=mysql\u fetch\u array($result)){?>

应该有如下内容:

if ($result.size > 0) {
  // do this
}

应该有如下内容:

if ($result.size > 0) {
  // do this
}