I need a little help for my problem...
Scene: I was trying to search something in my database but the result is "Query was empty" but the one I'm trying to search is already in my database. I'm trying to search the "Atrium Hotel"
Here's my screenshot of my Database:

Here's my screenshot of my result Page:

And Lastly here's my code:
<input type='submit' name='search' value='Search Building' onClick="this.form.action='search_bldg.php'; this.form.submit()">
<input type="text" id="idSearch"name="searchBldg" size="40" value="<?php echo $_POST['searchBldg']; ?>">
<fieldset width= "50px">
<legend>BUILDING/S</legend>
<?php
$search = $_POST["searchBldg"];
$data = mysql_query("SELECT * FROM tbldata WHERE fldBldgName LIKE '%$search%'");
$result = mysql_query($data) or die(mysql_error());
while($row = mysql_fetch_array( $result ))
{
echo $row['fldBldgName'];
}
?>
</fieldset>
I was wondering what is the problem in my query... Thanks in advance...
mysql- it's deprecated. UsemysqliorPDO. Also, your code is open to SQL inhection attack. Lastly, your code here is incomplete: nowhere does it emitQuery was empty.var_dump("SELECT * FROM tbldata WHERE fldBldgName LIKE '%$search%'")and see what the result is. Maybe there's just a logical error?