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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.