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
https://forums.phpfreaks.com/topic/93492-array-prob-help/#findComment-478983
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
https://forums.phpfreaks.com/topic/93492-array-prob-help/#findComment-479678
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
https://forums.phpfreaks.com/topic/93492-array-prob-help/#findComment-479686
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
https://forums.phpfreaks.com/topic/93492-array-prob-help/#findComment-479780
Share on other sites

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.