simcoweb Posted January 4, 2008 Author Share Posted January 4, 2008 Ken2k7... me either...lol! This one is a stumper. If the query fails it should meet the condition of the if/else and display the else content. Regarding your question, actually you can't select just one. The javascript validation prohibits the first item listed from being a selection (thanks to the javascript forum guys). It requires two selections to make it work. Gentlemen, I have to get some sleep. Gotta get up in less than 5 hours. Perhaps my rested eyes can spot the problem tomorrow. Thanks again for your posts. Let's tackle it in the morning! Quote Link to comment Share on other sites More sharing options...
redarrow Posted January 4, 2008 Share Posted January 4, 2008 dont get it man it a right sticky one i am tired aswell man........ god nows Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted January 4, 2008 Share Posted January 4, 2008 Have anyone tried to print out what mysql_num_rows is? I still say you should single quote them :S It's like when you insert something and you need the stupid quotes. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 4, 2008 Author Share Posted January 4, 2008 Ken2k7... it's a new day. I'll single quote 'em and give it a try again to get things started on the quest to solvation.. ! Kensk7, just wanted to report back, adding the single quotes actually broke the script. It returned...what else...a blank page! So I went back to the non-single quote setup. Still breaking, though, when searching for non-available data. Working on that. Ok, more info. I changed the second 'AND' condition (which is the loan_type) to an 'OR' and that works. Of course, it doesn't provide the accuracy of the 'AND' search that I need. But, at least it narrows possibly what the problem is. The second 'AND' condition is breaking when there's no matches. Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 4, 2008 Author Share Posted January 4, 2008 Ok, new update. I had someone look at this issue and what they had me do is remove the two 'or die(mysql_error()); ' statements associated with the $numrows and $results from the query. Once I did that the search worked perfectly. It displays the 'No results...' message when there are none (instead of just a blank page) and the results when there are matches. In explaining it, the 'or die' was causing the script to 'die' without producing an error message on the next page (since it was looking for a mysql_error). Therefore the blank page. In any event, i'd still like to know what was occurring for future edification and why it would 'die' at that spot. Just for reference, here's the final code used: if (isset($_POST['search'])) { // query for extracting lenders from amember database $category = strip_tags(trim($_POST['category'])); $loantype = strip_tags(trim($_POST['loan_type'])); //$loanamount = strip_tags(trim($_POST['loan_size'])); $sql = "SELECT * FROM amember_members WHERE is_lender='Yes' AND '$category' IN (category_1, category_2, category_3, category_4, category_5) AND '$loantype' IN (loan_type, loan_type2, loan_type3, loan_type4, loan_type5) ORDER BY top_3 LIMIT 10"; $results = mysql_query($sql); $numrows = mysql_num_rows($results); if ($numrows == 0){ include 'header.php'; echo "<h3>No Results Found</h3><br> <p class='bodytext'>No lenders matched your search criteria. Try modifying the search parameters for broader results.<br>\n"; echo "<br><input type=button value=\"Return to Search\" onClick=\"history.go(-1)\">"; include 'footer.php'; } else { include 'header.php'; echo "<h3>The following lenders meet your search criteria.</h3><br>\n"; // create display of results in abbreviated format while ($row = mysql_fetch_array($results)) { echo " <div class='wrapper_out' onmouseover=\"this.className='wrapper'\"; onmouseout=\"this.className='wrapper_out'\";> <table width='500' border='0' align='center'> <tr ><td colspan='2' class='lendertitle'>".$row['company_name']."</td></tr> <tr><td colspan='2' class='lenderdesc'>Company phone: ".$row['company_phone']."</td></tr> <tr><td width='300' class='lenderdesc'>Company contact: ".$row['company_contact']."</td> <td width='200'><a class='lenderlink' href='loanrequest.php?lenderid=".$row['member_id']."'>Submit Loan Request</a></td></tr> <tr><td colspan='2'>"; echo pullRating($row['member_id'],true,false,true); echo "</td></tr> </table></div><br />\n"; echo "<hr style='border-top: 1px dotted #666666' color='#666666' width='400' size='1'>"; } include 'footer.php'; } } Quote Link to comment Share on other sites More sharing options...
simcoweb Posted January 4, 2008 Author Share Posted January 4, 2008 Final note on this. It was just the 'or die(mysql_error())' function assigned to the $numrows statement. Once that was removed everything worked perfectly. The explanation for anyone's edification: When mysql_num_rows() returns a zero(false) the or die() is evaluated. Since there is no mysql_error() (which is set by the query, not any of the mysql_fetch_xxxx() or mysql_num_rows() function calls) nothing is displayed. Again, thank all of you for your help. It turns out it was something that simple! Another lesson learned Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.