MySqli search issue
Ok..I have to ask for some input.. been working on this most of the day and although I am getting closer I am now at a loss.
On my main admin page, I want to include a search area so the admin can search for several fields.
Here is the code. I actually got most of it from a post here and modified it for my needs. I am not getting any errors that I can tell. Just no results.
Here is the form code and the table to display the results.. What am I missing?
<form name="admsrch" method="get" action="">
Enter Record #, Last Name or License Number to search.
<br>
<table width="400" border="0">
<tr>
<td width="195" align="right">Record #</td>
<td width="195"><label for="mainID"></label>
<input name="mainID" type="text" id="mainID" size="30"></td>
</tr>
<tr>
<td align="right">Last Name</td>
<td><label for="lastName"></label>
<input name="lastName" type="text" id="lastName" size="30"></td>
</tr>
<tr>
<td align="right">License Number</td>
<td><label for="licenseNumber"></label>
<input name="licenseNumber" type="text" id="licenseNumber" size="30"></td>
</tr>
</table>
<br>
<input type="submit" name="submit" id="submit" value="Submit">
</form>
<table width="500" border="0">
<tr>
<td>Record Number</td>
<td>Last Name</td>
<td>License Number</td>
</tr>
<?php
while(!$rsResults->atEnd()) {
?>
<tr>
<td>
<?php echo($rsResults->getColumnVal("mainID")); ?></td>
<td><?php echo($rsResults->getColumnVal("lastName")); ?></td>
<td><?php echo($rsResults->getColumnVal("licenseNumber")); ?></td>
</tr> <?php
$rsResults->moveNext();
}
$rsResults->moveFirst(); //return RS to first record
?>
</table>
and here is the php I have.
<?php
$rsResults = new WA_MySQLi_RS("rsResults",$conn_mdb1,0);
$rsResults->setQuery("SELECT * FROM maintbl WHERE mainID LIKE ? OR lastName LIKE ? AND licenseNumber LIKE ? ORDER BY mainID ASC");
$rsResults->bindParam("i", "".(isset($_GET['mainID'])?$_GET['mainID']:"") ."", "-1"); //colname
$rsResults->bindParam("s", "".(isset($_GET['firstName'])?$_GET['firstName']:"") ."", "-1"); //paramNam
$rsResults->bindParam("s", "".(isset($_GET['licenseNumber'])?$_GET['licenseNumber']:"") ."", "-1"); //paramLic
$rsResults->execute();
?>
Thanks ahead of time.
New Update.. Fixed a couple of misspels firstName should be lastName and one other. I got it to search by all 3 fields by changing the ANDs to ORs. Is that correct?