Jump to content

deant

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

deant's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi Madtechie, Here is another line of coding falling beneath the coding which I sent previously on the same page. I'm not sure if this will be necessary to give you?? <?php $connection = mysql_connect('127.0.0.1', 'vale_view', '8hw9er1' ); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $db_select=mysql_select_db('vale_view'); if (!$db_select) { die ("Could not select the database: <br />". mysql_error()); } if ($_GET['k']) { if ($_GET['b'] != '0') { if ($_GET['c'] != '1') { $query = "SELECT * FROM companies where compname like '%".$_GET['k']."%' and catid = ".$_GET['b']." and areaid = ".$_GET['c']." ORDER BY COMPNAME"; } else { $query = "SELECT * FROM companies where compname like '%".$_GET['k']."%' and catid = ".$_GET['b']." ORDER BY COMPNAME"; } } else { $query = "SELECT * FROM companies where compname like '%".$_GET['k']."%' ORDER BY COMPNAME"; } } else { $query = "SELECT * FROM companies ORDER BY COMPNAME LIMIT 20"; } $result = mysql_query( $query ) or die('die'); if (!$result) { die ("Could not query the database: <br />". mysql_error()); } echo "<table border=0px width=100%>"; while ($result_row = mysql_fetch_row($result)) { echo "<tr><td>".$result_row[1]."</td><td>".$result_row[2]."</td><td>".$result_row[3]."</td></tr>"; }?></table><br/><br/></font> </td> </tr> <tr> <td colspan=5 align=center valign=top> <font face='Calibri' size=2>Vale-View © Copyright 2010</font> </td> </tr></table></center></body></html> Regards Dean
  2. Good day 'MadTechie', Thanks again. Below is the code involved for the category search. I think you are correct when you say that there is no GET / POST request for that, but only one for the keyword search, however I would like you to look at it in anycase just so every aspect is laid out. <form action=search.php method=get> Keyword : <input type=text name=k /> Category : <select name=b> <option value=0>All</option> <?php $connection = mysql_connect('127.0.0.1', 'vale_view', '8hw9er1' ); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $db_select=mysql_select_db('vale_view'); if (!$db_select) { die ("Could not select the database: <br />". mysql_error()); } $query = "SELECT catid,catname FROM categories order by catname"; $result = mysql_query( $query ) or die('die'); if (!$result) { die ("Could not query the database: <br />". mysql_error()); } while ($result_row = mysql_fetch_row($result)) { echo "<option value=".$result_row[0].">".$result_row[1]."</option>"; } mysql_close($connection); ?> </select> Area : <select name=c> <option value=1>All</option> <option value=2>Bedfordview</option> <option value=3>Edenvale</option> </select> <input type=submit value='Search' /> </form> </td> </tr> Regards Dean
  3. Okay, Thanks again for the quick feedback 'MadTechie'. I am glad to have this correspondence with you. It seems as though you get straight to the point and it's much appreciated. If I could ask you to go onto the website and check out what I mean: www.vale-view.co.za/search. Once on there you can test the drop down 'category' option and select a category, then proceed to click on the 'search' button - I'm sure you will get a better idea of what I am talking about and perhaps give a clearer perspective on this issue. Again, many thanks for the input, its a bit frustrating as everything seems to be set up, but probably just needs some tweaks on the coding....I can't tell. Kind Regards Dean Johannesburg
  4. I appreciate the input, what I mean by not working is this: On the web page itself, when I scroll onto the drop down menu list on 'categories' and then click on a category, thus displaying it in the box and then proceed to click on the 'search' button, it searches throughout the database (mysql), but wont give me the data which is listed under the category which I selected. It merely goes back to the first page of data pulled from the mysql database and thats it. I did try the code given, but doesnt help, it only makes the whole page dissapear with nothing on, but an error message. Any further suggestions? With appreciation, Dean
  5. Good day all, I am really in need of some help here with my website. I am new to the php and mysql environs, but an avid supporter and learner. I have a problem making my drop down 'category' option to work - as in when I select an option from the drop down list, it should pull the data from the mysql database which works magically with the keyword searches, etc...its just the category search not working - below is the coding which I am working with currently: action=search.php method=get> Keyword : <input type=text name=k /> Category : <select name=b> <option value=0>All</option> <?php $connection = mysql_connect('127.0.0.1', 'vale_view', '8hw9er1' ); if (!$connection) { die ("Could not connect to the database: <br />". mysql_error()); } $db_select=mysql_select_db('vale_view'); if (!$db_select) { die ("Could not select the database: <br />". mysql_error()); } $query = "SELECT catid,catname FROM categories order by catname"; $result = mysql_query( $query ) or die('die'); if (!$result) { die ("Could not query the database: <br />". mysql_error()); } while ($result_row = mysql_fetch_row($result)) { echo "<option value=".$result_row[0].">".$result_row[1]."</option>"; } mysql_close($connection); ?>
×
×
  • 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.