very confused getting this error: “You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘‘texas_schools’ WHERE school_name LIKE ‘t%’’ at line 1” please help me.
[php]session_start();
$_SESSION[‘state’] = ‘texas’;
$dbc = mysqli_connect(‘localhost’, ‘’, ‘’,’’)
or die(‘Error connecting to MySQL server’);
if (isset($_POST[‘school_sub’])) {
$school_sub = mysqli_real_escape_string($dbc,(trim($_POST[‘school_sub’]))) or die(myqli_error($dbc));
if (!empty($school_sub)) {
$state= $_SESSION[‘state’];
$tablename =$state. ‘_schools’;
$query = “SELECT school_name FROM ‘$tablename’ WHERE school_name LIKE ‘$school_sub%’”
or die(mysqli_error($dbc));
$result = mysqli_query($dbc, $query)
or die (mysqli_error($dbc));
mysqli_close($dbc);
while($row = mysqli_fetch_assoc($result)) {
echo “<div id=“results” onclick='addTextSchool(”".$row[‘school_name’]."");’>" . $row[‘school_name’] . “”;
}
}
}
[/php]