![]() | ![]() |
| |||
| heres the error Search For Seach for: in Events Day Results Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/squarebar/domains/nixysthesquarebar.com/public_html/search.php on line 44 Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/squarebar/domains/nixysthesquarebar.com/public_html/search.php on line 56 Sorry, but we can not find an entry to match your query Searched For: SATURDAY here is the code <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <h2>Search For</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> in <Select NAME="field"> <option value="events">Events</option> <option value="day">Day</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> <?php //This is only displayed if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they did not enter a search term we give them an error if ($find == "") { echo "<p>You forgot to enter a search term"; exit; } // Otherwise we connect to our Database mysql_connect("localhost", "squarebar", "square462") or die(mysql_error()); mysql_select_db("squarebar_db1") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM users WHERE upper($field) LIKE'%$find%'"); //And we display the results while($result = mysql_fetch_array( $data )) { echo $result['date']; echo " "; echo $result['day']; echo "<br>"; echo $result['events']; echo "<br>"; echo "<br>"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> </body> </html> any help would be good |
| ||||
| compare with how you make a db connection to how it's shown here: PHP MySQL Select and you will notice the mistake.
__________________ :. Web Design & Development Web Design Ireland :. Search Engines Optimization Search Engines Optimization :. Directory Submission Directory Submission :. News & Press Release Ireland GiveItSocks.com :. Used Cars Ireland, Car Parts & Car Audio Cars For Sale, Car Parts & Accessories :. I Have 2 Find It Directory SEF Directory |
| ||||
| also not the best idea to post these details on a public site Giving us your domain name ... your database username / password ... and so on
__________________ Forbairt Media | Web Design & Development Galway / Dublin, Ireland - coming soon ... ( vague but descriptive isn't it ) Recent Work: Safari Club African Safari Holidays - Botswana Safaris |
| Thread Tools | |
| Display Modes | |
|
|
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ruby on Rails VS PHP Code Igniter | gav240z | Coding Help | 10 | 03-02-2008 11:04 PM |