PHP Search Help

admin

Administrator
Staff member
Hey this is what i have.... i need to add adressfield1 2 and 3 to here. i set up a search before and now i have to add these fields but i dont know how the table is USERS i need to ad adressfield1 adressfield2 adressfield3 so they can search those too. Thank You, Andrew







<head>

<title></title>

</head>

<body>



<?





require("header.php");

require("db.php");



// Header table for all categories (just above all links)



print("<table cellSpacing=\"1\" cellPadding=\"2\" border=\"0\" width=\"130%\"> <tbody>");

print("<tr>");



print("<td vAlign=\"top\" bgColor=\"#3366FF\">Boat Make</a></td>");

print("<td vAlign=\"top\" bgColor=\"#3366FF\">Boat Type</a></td>");

print("<td vAlign=\"top\" bgColor=\"#3366FF\">Length</a></td>");

print("<td vAlign=\"top\" bgColor=\"#3366FF\">Price</a></td>");

print("<td vAlign=\"top\" bgColor=\"#3366FF\">Pic</td>");

print("</tr>");







// End of Header table







function getMinMaxSQL($dbField, $min, $max)

{

if ($min != '' && $max == '')

return " $dbField >= $min";

elseif ($min == '')

return " $dbField <= $max";



return " $dbField between $min and $max";

}



$query = 'select * from sites where ';

$bNeedAnd = false;

if ($make != "")

{

$query .= 'custom_field_6 like \'%' . $make . '%\'';

$bNeedAnd = true;

}










if ($type > 0)

{

if ($bNeedAnd)

$query .= ' and';

else

$bNeedAnd = true;



$query .= ' sitecatid=' . $type;

}





if ($minYear != "" || $maxYear != "")

{

if ($bNeedAnd)

$query .= " and";

else

$bNeedAnd = true;



$query .= getMinMaxSQL('custom_field_3', $minYear, $maxYear);

}



$sql_result = mysql_query ($query, $conID) or die("query failed" .mysql_error());

$num_links = mysql_num_rows($sql_result);









for ($i=0; $i<$num_links; $i++)

{

$row = mysql_fetch_array($sql_result);

$siteid = $row["siteid"];

$sitetitle = $row["sitetitle"];

$sitedescription = $row["sitedescription"];

$siteurl = $row["siteurl"];

$sitedate = $row["sitedate"];

$sitehits = $row["sitehits"];

$sitevotes = $row["sitevotes"];

$name = $row["name"];

$phone = $row["phone"];

$email = $row["email"];

$sitevotes = $row["sitevotes"];

$adressfield1 = $row["adressfield1"];

$adressfield2 = $row["adressfield2"];

$adressfield3 = $row["adressfield3"];

$catname = $row["catname"];

$custom_field_1 = $row["custom_field_1"];

$custom_field_2 = $row["custom_field_2"];

$custom_field_3 = $row["custom_field_3"];

$custom_field_4 = $row["custom_field_4"];

$custom_field_5 = $row["custom_field_5"];

$custom_field_6 = $row["custom_field_6"];

$custom_field_7 = $row["custom_field_7"];

$custom_field_8 = $row["custom_field_8"];

$picture = $row["picture"];

$dates= "$sitedate";

$sitedate1 =date("d.m.Y",time($dates));



// Here we print out each link.





print("<td bgColor=\"#eeeeee\">$custom_field_6</td>");

print("<td bgColor=\"#eeeeee\"><a href=http://www.phpbuilder.com/board/archive/index.php/\"detail.php?siteid=$siteid\">$sitetitle</a></td>");

print("<td bgColor=\"#eeeeee\">$custom_field_1</td>");

print("<td bgColor=\"#eeeeee\">$custom_field_2</td>");

print("<td bgColor=\"#eeeeee\">");





require("config.php");



if ($picture)

{

print($yes);

}



else

{

print($no);

}





print("</td></tr>");









}

// End fetch



print("</table>");





?>



<p>



<?

require("footer.php");

?>



</body>
 
Back
Top