Fatal error

Hi guys,

i hav fatal error after uploaded my files in ftp…

database connection pgm

<?php
$a=mysql_connect(“localhost”,“advocate_thiaga”,“buzzword”) or die(“error”);
mysql_select_db(“advocate_lawyer”,$a);
?>

i do a pgm for search engine
<?php

/*set varibles from form */
$city=$_REQUEST[‘city’];
$area=$_REQUEST[‘area’];
$advocate_type=$_REQUEST[‘advocate_type’];

trim ($city);
trim ($area);
trim ($advocate_type);

/* connects to database */
@ $dbconn = new mysqli(‘localhost’, ‘advocate_thiaga’, ‘buzzword’, ‘advocate_lawyer’);
if (mysqli_connect_errno())
{
echo ‘Error: Could not connect to database. Please try again later.’;
exit;
}
/query the database/
if (trim ($advocate_type) == ‘All’)
{
$query = “select * from tbl_su where city=‘$city’ and area=‘$area’”;
}
else
{
$query = “select * from tbl_su where city=‘$city’ and area=‘$area’ and advocate_type=‘$advocate_type’”;
}

$result = $dbconn->query($query);
/number of rows found/
$num_results = $result->num_rows;

echo ‘<p>Lawyer Information: ‘.$num_results.’</p>’;
/loops through results/
echo “<table border=‘1’>
<tr>
<th>Advocate Name</th>
<th>Advocate RegNo</th>
<th>Address</th>
<th>Phone Number</th>
<th>Email</th>
<th>Image</th>
</tr>”;

for ($i=0; $i <$num_results; $i++)
{

$row = $result->fetch_assoc();

echo “<tr>”;
echo “<td>” . $row[‘advocate_name’] . “</td>”;
echo “<td>” . $row[‘advocate_reg_no’] . “</td>”;
echo “<td>” . $row[‘address’] . “</td>”;
echo “<td>” . $row[‘phone’] . “</td>”;
echo “<td>” . $row[‘email’] . “</td>”;
echo “<td >”. ‘<img src="images/’.$row[‘image’].‘">’.“</td>”;

echo "&lt;/tr&gt;";

}
echo “</table>”;

/free database/
163line–$result->free();
$dbconn->close();

?>

But it shows fatal error when i click the button

the error is:
Fatal error: Call to a member function free() on a non-object in /home/advocate/public_html/search.php on line 163…

i mentioned tat line pls help me guys

That pgm is executed result in localhost…but online its shows fatal error

Your query failed, check that it executed successfully. :slight_smile: