|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||||
|
|||||
|
Error on Tutorial example.
I have tried your tutorial regarding fetching things from a database (http://codewalkers.com/tutorials/15/1.html) and splitting it into multiple rows after a predefined value but i get an strange behavior when i run the code, i do not get the first line in the database to show, i have checked the and that one returns 21 rows but the output only show the row 2-21.
This is my code: php Code:
I have set cols to a value of 3 Have i done something in above code that generates this or is there a miss in the turorial? |
|
#2
|
|||
|
|||
|
RE: Error on Tutorial example.
the for statement has a closing php tag in it that might be the culprit as well as the if Statement...
for($i = 0; $i < $num_rows ?>; $i++) { should look like for($i = 0; $i < $num_rows; $i++) { and if(($i % $cols) == ($cols - 1) || ($i + 1) == $num_rows?>) { should look like if(($i % $cols) == ($cols - 1) || ($i + 1) == $num_rows) { If that is in the actual code, fix those errors and try it again. |
|
#3
|
|||
|
|||
|
RE: Error on Tutorial example.
Hmm, the code i posted here has got some code i didn“t put in when writing this topic.....?
The code below is the one i got and it looks like the one you posted blindeddie. //changed this to a for loop so we can use the number of rows for($i = 0; $i < $num_rows; $i++) { $row = mysql_fetch_array($result); if($i % $cols == 0) { //if there is no remainder, we want to start a new row echo "<TR>n"; } echo "<TD>" . $row['id'] . "</TD>n"; if(($i % $cols) == ($cols - 1) || ($i + 1) == $num_rows) { //if there is a remainder of 1, end the row //or if there is nothing left in our result set, end the row echo "</TR>n"; } So what could be the problem??? |
|
#4
|
|||
|
|||
|
RE: Error on Tutorial example.
Does anyone have a solution on this, because i don't it's very strange.
|
![]() |
| Viewing: Codewalkers Forums > Other > Tutorials > Error on Tutorial example. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|