I am using a text box to search database for a reference number, the search is working ok but i am getting this error when i load the page for the first time:
Warning: mssql_fetch_obj ect(): supplied argument is not a valid MS SQL-result resource in C:\Documents . . . on line 167
When i do a search i get the expected results and the error disappears
here is my code:
how do i stopped the error from appearing when the page is first loaded?
Warning: mssql_fetch_obj ect(): supplied argument is not a valid MS SQL-result resource in C:\Documents . . . on line 167
When i do a search i get the expected results and the error disappears
here is my code:
Code:
<form id="refsearch" name="searchRef" method="post">
<table>
<tr>
<td>Enter Call Ref</td>
<td><input name="searchref" type="text" class="textfield" id="searchref" /></td>
</tr>
<tr>
<td><input type="submit" name="search" value="Search" /></td>
</tr>
<?php
$reference = $_POST['searchref'];
$query = "SELECT AmberCatRequestId ";
$query.= "FROM Customer_Calls ";
$query.= "WHERE CustomerCallId = $reference";
$result = mssql_query($query);
if($row = mssql_fetch_object($result))
{
$ref = $row->AmberCatRequestId;
}
?>
<tr>
<td><h4><br />AmberCat Request: </h1></td>
<td><h1><br /><?echo $ref;?></h4></td>
</tr>
</table>
</form>
Comment