Jump to content

[SOLVED] multiple mysql queries for a simple search engine


kaozdragon

Recommended Posts

i'm really new at php and i was trying to look online for simple php search engine scripts and they all seemed too complicated...especially for my needs.  and the one on about.com or smth didn't even work.  so i tried making my own.  the problem is i don't know how to get my mysql_queries to look at multiple variables to limit the search.  Here's what i have so far.

 

<?php

include("connectionx.php");

include("header.php");

$fname = $_POST["fname"];

 

echo "<center>Results</center><BR>";

 

$result = mysql_query("SELECT * FROM users WHERE firstname LIKE '%$fname%' ORDER

 

BY lname, fname");

while ($row = mysql_fetch_array($result))

{

echo "<a href='info.php?id=" . $row['id'] . "'>" . $row['lname'] . ", " . $row

 

['fname'] . "</a><br>";

}

include("footer.php");

?>

 

what i want is the person to be able to search for a similar first name and say...an age between 15-25.  thanks.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.