HAVOCWIZARD Posted June 12, 2007 Share Posted June 12, 2007 hey coders....have this problem in counting the the amount of record found, so that i acn preview them one by one, i added the minus value so that i will only display what it has in the array otherwise it loops, my problem is counting the records correctly, if anybody can help pls.. here is some of the code where the problem is for($loop_fields = 0; $loop_fields <= 43; $loop_fields++) { // run through keywords list and create query // sql query start $result = mysql_fetch_array($data); $result_fnd = count($data); for ($loop_result = 0; $loop_result <= $result_fnd; $loop_result++) { if($result != "") { // $result_fnd = $result_fnd -1; echo '<div id="resultDIV' . $loop_result . '" style="" class="textField">'; echo ' <table style="width:100%;">'; echo ' <tr>'; echo ' <td style="width:75%">'; // company name echo ' <a href="javascript:showHideDIV(\'resultDropDownDIV' .$loop_result . '\')" class="linkResults">'; Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/ Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Are you wanting to display the contents of fields from a database? Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273089 Share on other sites More sharing options...
HAVOCWIZARD Posted June 12, 2007 Author Share Posted June 12, 2007 it does diplay, it just that the div is counting wrong on the loop key, it doesnt count the correct amount of records found Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273092 Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Can you post some sample HTML surrounded with [code] and [/code] please? Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273094 Share on other sites More sharing options...
HAVOCWIZARD Posted June 12, 2007 Author Share Posted June 12, 2007 <h2>Search</h2> <form name="search" method="post" action="<?=$PHP_SELF?>"> Seach for: <input type="text" name="find" /> </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; } // 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 registrations WHERE upper(register_companyName) LIKE'$find', "); $data = mysql_query("SELECT * FROM registrations WHERE register_companyName = '$find' or register_contactPerson = '$find' or register_telephoneNumber = '$find' or register_telephoneNumber2 = '$find' or register_faxNumber = '$find' or register_cellphoneNumber = '$find' or register_emailAddress = '$find' or register_website = '$find' or register_address1 = '$find' or register_address2 = '$find' or register_area = '$find' or register_suburb = '$find' or register_province = '$find' or register_country = '$find' or register_postalCode = '$find' or register_business = '$find' or register_description = '$find' or register_trading = '$find' or register_Mcat = '$find' or register_keyword1 = '$find' or register_keyword2 = '$find' or register_keyword3 = '$find' or register_keyword4 = '$find' or register_keyword5 = '$find' or register_keyword6 = '$find' or register_keyword7 = '$find' or register_keyword8 = '$find' or register_keyword9 = '$find' or register_keyword10 = '$find' or register_keyword11 = '$find' or register_keyword12 = '$find' or register_keyword13 = '$find' or register_keyword14 = '$find' or register_keyword15 = '$find' or register_keyword16 = '$find' or register_keyword17 = '$find' or register_keyword18 = '$find' or register_keyword19 = '$find' or register_keyword20 = '$find' or register_latitude = '$find' or register_longitude = '$find'"); for($loop_fields = 0; $loop_fields <= 43; $loop_fields++) { // run through keywords list and create query // sql query start $result = mysql_fetch_array($data); $result_fnd = count($result); for ($loop_result = 0; $loop_result <= $result_fnd; $loop_result++) { if($result != "") { // $result_fnd = $result_fnd -1; this is the top part of the code is this what u mean ? Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273097 Share on other sites More sharing options...
Yesideez Posted June 12, 2007 Share Posted June 12, 2007 Please use the CODE tags when postign code. Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273098 Share on other sites More sharing options...
HAVOCWIZARD Posted June 12, 2007 Author Share Posted June 12, 2007 sorry. now i know what u mean, still new at this posting thing.lol Quote Link to comment https://forums.phpfreaks.com/topic/55250-solved-counting-problem/#findComment-273102 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.