View Single Post
Old 11-19-2012, 04:33 PM   PM User | #5
willscarlet
New Coder

 
Join Date: Aug 2012
Posts: 65
Thanks: 5
Thanked 0 Times in 0 Posts
willscarlet is an unknown quantity at this point
Ok, that cleared one error. Now it still shows one more error though:
Warning: sqlsrv_fetch_array() expects parameter 1 to be resource, boolean given in C:\Inetpub\wwwroot\msag\index.php on line 43

New code is:
PHP Code:
<center><h1><u> MSAG Database </u></h1>
<br>            
<br>
        
<?php include 'includes/menu.php'?>
            
<form method="post" action="index.php">
<input type="hidden" name="submitted" value="true" />

<label>Search Category:

<select name="category">
    <option value="StreetName">Street Name</option>
</select>
</label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label>Search Criteria: <input type="text" name="criteria" /></label>

<input type="submit" name="search" value="Search"/>

</form>

</center>
<?php

include 'includes/db/connect.php';

if(isset(
$_POST['search']) || isset($_POST['submit']))
{     
    
$category $_POST['category'];
    
$criteria $_POST['criteria'];
    
    
$query "SELECT * FROM MSAG WHERE $category LIKE %$criteria% ORDER BY StreetName ASC";
    
$resource=sqlsrv_query($conn$query);
}    
?>
<form action="" method="post">
        <table align="center" border="1" cellpadding="2" cellspacing="2" width="100%" >
        <tr align = 'center'>
            <td><b>Street Name</b></td>
        </tr>
<?php
while($result=sqlsrv_fetch_array($resource))

    echo 
"
<tr align = center>
<td>"
.$result['StreetName']."</td>
<td><a href=\"modify2.php?id="
.$result['StreetID']."\"><input type=\"button\" name = \"details\" value = \"Details\" /></a></td>
</tr>
"
;         
}
?>
</table>
</form>
willscarlet is offline   Reply With Quote