Mark is right, but here's something that may get you started:

You need to do a query that looks something like: "SELECT * FROM search
WHERE zipcode=".$_POST["zip"]."";

Where $_POST["zip"] would be replaced by whatever method and variable you're
using to get the search criterion into the query string.

Your result set will contain all columns in your table that include the zip
code your user provides.

To get the output I think you're looking for, you need to iterate over that
result set with a WHILE loop like this:
echo "<table>";
while($row=mysql_fetch_array($result)){
        echo
"<tr><td>".$row["address"]."</td><td>".$row["zip"]."</td></tr>";
}
echo "</table>";

For each of the column values you want to show your user, you'll need to
have a $row["colname"] bracketed by the open and close <td> tags.

None of this code has actually been tested, but it should be pretty close to
right. It's early here and, like Mark said, you didn't provide a whole lot
to go on, but hopefully this'll be enough to get you going in the right
direction.

HTH,
Rich

> -----Original Message-----
> From: Snijders, Mark [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 19, 2003 3:09 AM
> To: 'Michelle Whelan'; [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] SELECT * FROM Command
> 
> 
> guess it is hard to answer this with so less information
> 
> first show us how the table defenition is... how it is build 
> up and then
> which fields you want to show to the user!
> 
> then I or others can help you much more!!
> 
> 
> 
> _______________________________ 
> 
> Mark Snijders, Developer 
> Atos Origin 
> Groenewoudeseweg 1, Room VN-515 
> 5621 BA  Eindhoven, The Netherlands 
> *   : [EMAIL PROTECTED] 
> *    :+31 (0)40 - 2785992 (tel) 
> * : +31 (0)40 - 2788729 (fax) 
> 
> The information in this mail is intended only for use of the 
> individual or
> entity to which it is addressed and may contain information that is
> privileged, confidential and exempt from disclosure under 
> applicable law.
> Access to this mail by anyone else than the addressee is 
> unauthorized. If
> you are not the intended recipient, any disclosure, copying, 
> distribution or
> any action taken omitted to be taken in reliance of it, is 
> prohibited and
> may be unlawful.
> 
> 
> 
> 
> -----Original Message-----
> From: Michelle Whelan [ mailto:[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> ]
> Sent: woensdag 19 maart 2003 9:06
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] SELECT * FROM Command
> 
> 
> 
> Hi,
> 
> I have a question about how to display results.  I am using 
> PHP with a mysql
> database through yahoo webhosting.  I've created a form (html 
> & javascript)
> that lets the user post data to one of the tables in my 
> database.  On a
> separate page, I've created a form that will do a SELECT * 
> FROM search (by
> zipcode) on the database that the user posted data to. 
> 
> Now here's my question..
> 
> I want the query to search the db and return results for 
> matching zip  codes
> and display that plus the other info that was posted by the user. 
> 
> I have it right now so that the results displayed are simply 
> only the zip
> code that matches is coming back and it displays how ever 
> many times in
> matches.
> 
> I hope this makes sense.
> 
> Thanks in advance for any help.
> 
> Michael
> 
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to