Jump to content

array prob help


edwardoit

Recommended Posts

here some example..

 

while ($search = mysql_fetch_assoc($result)) {
<tr><td>some results</td></tr>

#somewhere at the end i put this so i could gather some data from query...
$inlist[] = $zero;
}


foreach ($inlist as $currentvalue) {
echo "<tr><td colspan = \"14\">$currentvalue</td></tr>";

 

i got:

0
1
1
1
0
0
0

 

 

how could i display only the 1's and not display 0's.

 

Link to comment
Share on other sites


while ($search = mysql_fetch_assoc($result)) {
<tr><td>some results</td></tr>

#somewhere at the end i put this so i could gather some data from query...
if(isset($inlist[$ctr][num]) ctr++;
$inlist[$ctr][num] = $zero;
$inlist[$ctr][age] = $hero;
$inlist[$ctr][name] = $nero;

}


foreach ($inlist as $list) {
if($list[num] == 1){
  echo "<tr><td colspan = \"14\"> $list[name] </td>  <td>$list[age]</td>  <td> $list[num] </td>  </tr>";
}
}

 

i am NOT second best ANYmore

Link to comment
Share on other sites

on this part...

 

if(isset($inlist[$ctr][num]) ctr++;
$inlist[$ctr][num] = $zero;
$inlist[$ctr][age] = $hero;
$inlist[$ctr][name] = $nero;

 

displays:

Parse error: syntax error, unexpected T_STRING in /var/www/test/list.php on line blah...

 

is it the opeing and closing() ? or what? i dont know...

please keep in touch... i still ned ur help..

Link to comment
Share on other sites

i just want to happen is count all the result of

 

foreach ($inlist as $list) {
if($list[num] == 1){
  echo "<tr><td colspan = \"14\"> $list[name] </td>  <td>$list[age]</td>  <td> $list[num] </td>  </tr>";
}
}

 

i want to know how to count all ther esult.

patience for the me please... im still learning  ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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