I'm trying to make an simple search engine, and the results are displayed fine as it is now. The only problem I have is I want it to be a little more presentable.
This is the code as it stands (I also have a another .php where it gets the searchval, searchfunction and jQuery)
<?php
mysql_connect ("localhost","root","xxxxxxx") or die ("Connectionissues");
mysql_select_db ("xxxxxxxx") or die("Can't find database");
$output = '';
if(isset($_POST['searchVal'])) {
$searchq = $_POST['searchVal'];
$searchq = preg_replace ("#^0-9a-z#^1"," ",$searchq);
$query = mysql_query("SELECT * FROM ds_OrderItem WHERE idProduct LIKE
'%$searchq%'") or die("Search incomplete!");
$count = mysql_num_rows ($query);
if($count == 0){
$output = 'Order have never been made before';
}else{
while($row = mysql_fetch_array($query)) {
$idproduct = $row['idProduct'];
$idorder = $row['idOrder'];
$title = $row['title'];
$qty = $row['qty'];
$output .= '<div> '.$idproduct.' '.$idorder.' '.$title.' '.$qty.'
</div>';
}
if($_POST['searchVal'] == NULL) {
$output = "";
}
}
}
echo ($output);
?>
To limit the searchresults I tried to make an if statement before the when statement like this:
if($count = <100){
$output = 'Too many results!';
And for the table I have tried various methods, and I always end up making the simple HTML table, but I cant get the search results to post within the four columns.