-1

Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\Search\search.php on line 5

Cant explain whats wrong with my if

<?php
mysql_connect("localhost","root","") or die("could not connect");
mysql_select_db("search") or die("could not find db")

if(isset($_POST['search'])){
    $searchq = $_POST['search'];
    $searchq = preg_replace("#[^0-9a-z]#i","",$searchq);

    $query = mysql_query("SELECT * FROM students WHERE firstname LIKE '%$searchq%' OR lastname LIKE '%$searchq%'") or die("could not search!");
    $count = mysql_num_rows($query);
}
    if($count == 0){
        $result = 'There was no search results!';
        else{
            while($row = mysql_fetch_array($query)){
                $fname = $row['firstname'];
                $lname = $row['lastname'];
                $id = $roq['ic'];

                $output .= '<div>'.$fname.' '.$lname.'</div>';
        }
    }
}
?>
Liv
  • 21
  • 2

1 Answers1

2

Please add semicolon (;) on following line

mysql_select_db("search") or die("could not find db");
Narayan Bhandari
  • 426
  • 3
  • 11