-2

I get the following error "syntax error, unexpected '$records1' (T_VARIABLE)" if I put the if line in my code. Why? I don't understand it.

<?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.'.';
    }

}
?> 
RiggsFolly
  • 89,708
  • 20
  • 100
  • 143

1 Answers1

0

Your if has a missing parentheses, it's not supposed to be

if (!empty($continent)

it's

if (!empty($continent))
RiggsFolly
  • 89,708
  • 20
  • 100
  • 143
DannyM
  • 640
  • 6
  • 18