> > Jason, > > Untested, but try this... > > function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, > $Add2) { > $qstring = "SELECT * FROM ".$table." WHERE FName like > '%$searchvar%' > or LName like '%$searchvar%' or Add1 like > '%$searchvar%' or Add2 like > '%$searchvar%' or City like '%$searchvar%' or > State like '%$searchvar%' > or Zip like '%$searchvar%' or XCode like > '%$searchvar%'"; > > $qrow = mysql_query($qstring) or die(mysql_error()); > $qresult = $qrow; > $num_rows = mysql_num_rows($qresult); > > $outputStr = "<table>"; > > while($qrow = mysql_fetch_assoc($qresult)) { > $FName = $qrow['FName']; > $LName = $qrow['LName']; > $Add1 = $qrow['Add1']; > $Add2 = $qrow['Add2']; > > $outputStr .= > "<tr><td>$FName</td><td>$LName</td><td>$ADD1</td><td>$ADD2</td></tr>\n"; > > } > > $outputStr .= "</table>"; > > > return $outputStr; > > } > > $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, > $Add1, $Add2); > > echo $searchReturn; > > David > Hold on a moment... function search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2) { $qstring = "SELECT * FROM ".$table." WHERE FName like '%$searchvar%' or LName like '%$searchvar%' or Add1 like '%$searchvar%' or Add2 like '%$searchvar%' or City like '%$searchvar%' or State like '%$searchvar%' or Zip like '%$searchvar%' or XCode like '%$searchvar%'"; $qresult = mysql_query($qstring) or die(mysql_error()); // $qresult = $qrow; // this line is the problem ! $num_rows = mysql_num_rows($qresult); $outputStr = "<table>"; while($qrow = mysql_fetch_assoc($qresult)) { $FName = $qrow['FName']; $LName = $qrow['LName']; $Add1 = $qrow['Add1']; $Add2 = $qrow['Add2']; $outputStr .= "<tr><td>$FName</td><td>$LName</td><td>$ADD1</td><td>$ADD2</td></tr>\n"; } $outputStr .= "</table>"; return $outputStr; } $searchReturn = search($searchvar, $table, $num_rows, $FName, $LName, $Add1, $Add2); echo $searchReturn; That should work, assuming the query returns at least one row.. David