This is a discussion on I'm having a problem with my search engine! within the Php and MySQL forums, part of the Programming / Scripting / Coding category; Hi, I've been building a search engine for my works website which will enable people to search for articles that ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| | #1 (permalink) |
| Newbie | Hi, I've been building a search engine for my works website which will enable people to search for articles that are stored in a mysql database. Now, I don't have alot of knowledge of php and mysql, but I've learned quite a bit over the last couple months which has enabled me to build the search engine. So far I've got a working search that will bring in the articles based on what word is typed into the search box, and it will get it from the database and put it into a page. All tha works fine, there are just a few smaller things that I need sorted out before I can continue. 1) I would like to know how I could have a search box, that also functions as a drop down menu. It would have a list of categories, but you could also click in and type in whatever you like, kinda the way the Google tool bar works, but the categories would be preset, not words that you had already typed in. Is this possible to do. 2) Here's the other thing. I'm not sure how to explain this but I'll try. I've got a php script which does all the searching and brings in the links to the articles and lays them out on the page. My page has a table on it which is split into 2 columns, and the code is in the one on the left. Now, when I view the page in the browser it doesn't show the column on the right, it just deletes it altogether. So, I'm wondering if there's something in my php code that prevents it from showing the other column. The strange thing is that it will once the search has been done and the links to the articles come up, but not before. It also won't show up anything that is below the code, as in the same way as with the right hand column. Here's my code so that if there's anything that would cause this it can be shown. PHP Code: </a> <a href="http://www.pwamm.com/articles.php?id=<? echo $id ?>"><? echo $header ?></a><br /> <? echo $excerpt ?><br /> <? } ?> This is the entire code, it's split up a bit at the end. If anyone knows if I could write this in a better way I'm open to improvements, but my 2 issues are crucial just now. Thanks for any help. |
| | |
| | #2 (permalink) |
| Moderator | If you simply put the above code into the left column of the table it should work how you want with regards to the right column. As for the drop down box you'd need to add the drop down to the same form which handles the search: Code: <select name="category"> <option value="" selected="selected"></option> <option value="sport">Sport</option> </select> Code: $field_to_search3 = "category"; Code: if(isset($_GET['category'])){
$field_to_search3 = $_GET['category'];
}else{
$field_to_search3 = What_if_category_not_searched?
}
|
| | |
| | #4 (permalink) |
| Newbie | I've discovered that it only deletes things that are below the code, becasue when I look at the html, the right hand column is actually below the php code, so everything that is below the php code is deleted until the actual search is done. I still have no idea why though. |
| | |
| | #6 (permalink) |
| Newbie | Here's the link to the page. I've tried everything I know but it still won't do what I need it to do. http://www.pwamm.com/articlelinks.php You'll see that when the page comes in it doesn't show the right side column or the bottom bar, but when a search is made and results are shown then it brings them back in. Maybe seeing it will help understand it. |
| | |
| | #7 (permalink) |
| Super Moderator | Looking at the page code, you don't have anythign past the "Please enter a search..." Check your error log as there's probably a PHP error which causes the page generation to terminate prior to sendign everything.
__________________ Alex Monaghan - Monaghan Consultants Ltd Web hosting, ADSL, IT & Database consultancy Custom Web hosting on UK or USA servers using Linux (cPanel) or Windows (DotNetPanel) Mobile Phone Ringtones, Logos, Java Games & more |
| | |
| | #8 (permalink) |
| Newbie | Hi, I've discovered why it isn't working, so I just need some help with solving the problem. The problem is that the everything after the php code is deleted, or so I thought. Turns out that it's because of an exit command, which causes the rest of the page to stop and so doesn't get displayed. Here's the code : PHP Code: So, I need to know how I can change the code in such a way that the rest of the script is loaded, by taking the exit out, and that the database contents are shown only when a search has been made! Cheers! |
| | |
| Tags |
| engine, problem, search |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A new search engine that I built | farmer_Tom | Online Marketing and Website Promotion | 17 | 12-03-2006 16:07 |
| Search Engine Optimization | Wistow | SEO Articles | 2 | 10-10-2005 07:14 |
| IFoundIt.net - PR3 Search Engine | Wistow | Websites For Sale | 0 | 21-07-2005 17:40 |
| Search Engine Submitter | KF1 | Php and MySQL | 14 | 19-07-2005 19:22 |
| Would you use a new search engine? | Wistow | General Webmaster Discussion | 9 | 03-04-2005 19:53 |