--- Michelle Whelan <webmaster@dirtjobs.com> wrote: > > -Ok, this is what I have. I hope this is what you are looking for. > I'm looking to format this search results page so that the > results come back with the entire entry that also matches the > zipcode that was searched. > > ex: zipcode search = 90210 > > results for 90210 are: > > contactname > > phone number > > city > > date posted > > etc. > > AND, somehow ( I'm thinking ordered list) to have a format for > multiple results sorted by date. > > Is this possible? > > Thanks again in advance > > Michael > > <html> > <head> > <title>www..com</title> > </head> > > <body BACKGROUND="images/dirt.gif" text="#FFFFFF" link="#FFFFFF" > vlink="#FFFF00" alink="#FFFF00" BGPROPERTIES="fixed"> > > <? > > /* MySQL details */ > $dbHost = "mysql"; > $dbUser = ""; > $dbPass = ""; > $dbName = ""; > $table = "havedirt"; > > /* Attempt connection to MySQL server */ > $link = @mysql_connect($dbHost, $dbUser, $dbPass); > > /* If connection wasnt successful... */ > if (!$link) > { > print ("<b>Error:</b> Could not connect to database."); > exit; > } > > /* Attempt to select our database */ > if (!@mysql_select_db($dbName)) > { > print("<b>Error:</b> Could not find $dbName database."); > exit; > } > > $ZipCode = "$_POST["zipcode"]"; > > /* Build SQL query to fetch all entries from the table */ > $query = "SELECT * FROM $table WHERE zipcode = "$ZipCode"; > > /* Execute query */ > $result = mysql_query($query); > > /* If there was a problem with the query... */ > if (!$result || @mysql_num_rows($result) < 1) > { > print("No entries in table $table."); > exit; > } > print("<table>"); print("<tr>"); $fields = mysql_list_fields($dbName,$table,$link); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { print ("<th>".mysql_field_name($fields, $i)."</th>"); } print ("</tr><tr>"); foreach ($row as $key=>$val) { print ("<td>$val</td>"); } print ("</tr>"); > print("</table>"); > > /* Close link to MySQL */ > mysql_close($link); > > ?> > > </body> > </html> ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php