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. Link to comment https://forums.phpfreaks.com/topic/60047-solved-multiple-mysql-queries-for-a-simple-search-engine/ 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. Link to comment https://forums.phpfreaks.com/topic/60047-solved-multiple-mysql-queries-for-a-simple-search-engine/#findComment-298665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.