kaozdragon Posted July 15, 2007 Share Posted July 15, 2007 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. Quote Link to comment Share on other sites More sharing options...
kaozdragon Posted July 15, 2007 Author Share Posted July 15, 2007 sorry, simple answer....just had to use || and && operators. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.