Jump to content

chuck1971

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chuck1971's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have a drop down search form that I am populating with information from my database, and when I try to use it to search, I am returned with my page, but with no results. What am I doing wrong here? Thanks in advance for all te help!Here is the drop down code and the results page: <td> <select name="county" class="form" id="county" style="width: 165px"> <option value="">Any</option> <? include("includes/connect.php"); $county = mysql_query("SELECT * FROM locations ORDER BY county ASC"); while($result_county = mysql_fetch_array($county)) { ?> <option value="<? echo $result_county['county']; ?>" ><? echo $result_county['county']; ?></option> <? } ?> </select></td> <td align="right"><input name="Submit" type="submit" class="form" value="Submit" /> And here is the code for the results page: <? include("includes/connect.php"); $id = $_GET['id']; $query = mysql_query("SELECT * FROM locations WHERE id = $id"); $result = mysql_fetch_array($query); $numrows=@mysql_num_rows($query); if($numrows != 0) { while ($result = mysql_fetch_array($query)) { ?> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="justify" style="padding-top:1ex; padding-right:1.5ex; padding-bottom:1ex; padding-left:1.5ex"><strong><? echo $title; ?></strong><br /><? echo $address; ?><br /><? echo $city; ?>, <? echo $state; ?> <? echo $zipcode; ?><br />Phone: <? echo $phone; ?><br /><a href="location_details.php?id=<? echo id; ?>">Click Here for more information</a></div></td> </tr> </table></td> </tr> <? } } ?>
  2. I have two tables, one table (article_cat) has four fields ("id", "title", "feature1", and "feature2") and the other table has six fields (articles) has ("id", "cat_id", "title", "content", "feature1", and "feature2"). I am looking to display the "title" from the "article_cat" table that has "feature1" with a value of 1. And I want to display beneath that all the "title" results from the "articles" table where "feature1" has a value of 1. I have tried this a thousand ways with no luck. Here is a representation of what I want: TITLE (article_cat) title (articles) title (articles) title (articles) I was hoping someone can show me the err of my ways. Thanks so much in advance to all those who help! Here is the flawed code I have thus far: <? include("includes/connect.php"); $query = mysql_query("SELECT * FROM articles, article_cat WHERE articles.feature1 = 1 AND article_cat.feature1 = 1 ORDER BY id ASC"); $numrows=@mysql_num_rows($query); if($numrows != 0) { while ($result = mysql_fetch_array($query)) { ?> <tr> <td align="left" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top"><strong><? echo $result['article_cat.title']; ?>:</strong><br> <strong>></strong><a href="article_details.php?id=<? echo $result['id']; ?>"><? echo $result['articles.title']; ?></a><br> </td> </tr> </table> </td> </tr> <? } } ?> Thanks for the help, All. I cannot express my appreciation here!
×
×
  • 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.