Jump to content

[SOLVED] counting problem


HAVOCWIZARD

Recommended Posts

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">';

 

Link to comment
https://forums.phpfreaks.com/topic/55250-solved-counting-problem/
Share on other sites

<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 ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.