spooke2k Posted July 16, 2007 Share Posted July 16, 2007 please help am so stuck im only display 19 restults and for life of me cant work out why Its a nightmare im sure its something obvious but i cant work it out Ps this isnt all cod ejust code that relates to the loops Thanks select * from pressimagelink where details like '%g069%' or productcode like '%g069%' order by productcode asc LIMIT 0,20 $rowsPerPage = 20; $count = 1; while($row = mysql_fetch_array($result)) { $productname[$count] = $row['productcode']; $radioList = array($productname[$count] => $productname[$count]); $count ++; } $start = 1; $end = 5; //$totalplus = 1; while($start <> $end) { // Sets initals product Code Array & Sets Radio Array $count = 1; //While set of 5 check first $stoponfive = 1; //set Product while($stoponfive != 6) { $totalall = ($totalplus + $stoponfive); echo "<td width=\"15%\"><div align=\"center\"> Product Code {$productname[$totalall]}</div></td>"; $stoponfive ++; } // Return line echo "<tr>"; echo "</tr>"; $stoponfive = 1; //set image while($stoponfive != 6) { $totalall = ($totalplus + $stoponfive); echo "<td width=\"15%\"> <div align=\"center\"> <img src=\"http://images/{$productname[$totalall]}.jpg\" alt=\"no image available\"/></div></td>"; //echo $productname[$totalall]; $stoponfive++; } // Return line echo "<tr>"; echo "</tr>"; $stoponfive = 1; //set radio while($stoponfive != 6) { //checks against previous values in checked $selected = ($value==$_POST[group2])?' checked':''; $totalall = ($totalplus + $stoponfive); echo "<td width=\"15%\"><div align=\"center\"> <input type=\"radio\" name=\"group2\" value=\"$productname[$totalall]\"$selected></div></td>"; $stoponfive ++; } echo "<tr bgcolor=\"#CCCCCC\"> <td height=\"10\" colspan=\"5\"></td> </tr>"; echo "<tr>"; echo "</tr>"; $start ++; if($totalplus == 1) { $totalplus = $totalplus + 5; }else { $totalplus = $totalplus + 5; } } Link to comment https://forums.phpfreaks.com/topic/60260-missing-return/ Share on other sites More sharing options...
sasa Posted July 16, 2007 Share Posted July 16, 2007 in start $totalall = ($totalplus + $stoponfive); is 2 = 1 + 1, but your first index of $productname is one Link to comment https://forums.phpfreaks.com/topic/60260-missing-return/#findComment-299744 Share on other sites More sharing options...
spooke2k Posted July 16, 2007 Author Share Posted July 16, 2007 sorry but what do you mean i need to change exactly which bit as i set that calulation on more than one point thanks. Link to comment https://forums.phpfreaks.com/topic/60260-missing-return/#findComment-299761 Share on other sites More sharing options...
sasa Posted July 16, 2007 Share Posted July 16, 2007 ups i don'i see comment mark online //$totalplus = 1; are you shure that your query return 20 lines? try to echo mysql_num_rows($result); Link to comment https://forums.phpfreaks.com/topic/60260-missing-return/#findComment-299772 Share on other sites More sharing options...
spooke2k Posted July 16, 2007 Author Share Posted July 16, 2007 it is bringing back 20 as it should on count displaying 19 on page Thanks for help Link to comment https://forums.phpfreaks.com/topic/60260-missing-return/#findComment-299774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.