-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
  • 93,638
  • 21
  • 103
  • 149

1 Answers1

0

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

if (!empty($continent)

it's

if (!empty($continent))
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
DannyM
  • 743
  • 6
  • 20