firsly il post the code and error msg in im keep getting when trying to display records based on a combobox selection from a previous page: -
heres the code that (theoretically) should retun all equipment details based on the location selected on the previous page-
Code: Select all
if(array_key_exists("cmdSearch", $_POST) )
{
open_db();
$query = "SELECT Equipment, Description, Location, Area, Bookable FROM Equipment WHERE Location = ".$_POST["cmbLocation"]."";
$result = mssql_query($query) or die ("error in connection");this is the eror msg i keep getting
here the code for the combobox on the previous page - cmbLocationWarning: mssql_query(): message: Line 1: Incorrect syntax near '='. (severity 15) in d:\inetpub\wwwroot\admin\manageequipment.php on line 54
Warning: mssql_query(): Query failed in d:\inetpub\wwwroot\admin\manageequipment.php on line 54
error in connection
Code: Select all
<select name="cmbLocation" id="cmbLocation">
<?php
open_db();
$query = "SELECT COUNT (Equip_ID), Location FROM Equipment GROUP BY Location ORDER BY Location ASC";
$result = mssql_query($query) or die ("error in connection");
while($Equipment = mssql_fetch_assoc($result))
{
echo("<option value=".$Equipment["Equip_ID"].">".$Equipment["Location"]."</option>");
}
mssql_close();
?>
</select>any/all advice is appreciated and thank you in advance