如果我在我的代码中加入if行,我得到以下错误 "语法错误,意外的'$records1'(T_VARIABLE)"。为什么会这样?我不明白。
<?php
$continent = $_GET['continent'];
if (!empty($continent)
{
$records1 = mysqli_query($link, "SELECT name, capital From country where continent='$continent'");
while ($data1 = mysqli_fetch_array($records1))
{
$nume=$data1['name'];
$capitala=$data1['capital'];
echo '<br>'.'<br>';
echo 'Tara'.' '.$nume.' are capitala '.$capitala.'.';
}
}
?>
你的if有一个缺失的括号,它不应该是
if (!empty($continent)
它
if (!empty($continent))