语法错误,意外的'$records1'(T_VARIABLE) [重复]

问题描述 投票:0回答:1

如果我在我的代码中加入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.'.';
    }

}
?> 
php mysql variables
1个回答
0
投票

你的if有一个缺失的括号,它不应该是

if (!empty($continent)

if (!empty($continent))
© www.soinside.com 2019 - 2024. All rights reserved.