Tutorials
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOtherTutorials

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
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  
Old November 20th, 2003, 08:21 AM
soulskater soulskater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 13 soulskater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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
php Code:
Original - php Code
  1. $num_rows
and that one returns 21 rows but the output only show the row 2-21.

This is my code:
php Code:
Original - php Code
  1.  
  2.  echo "<TABLE BORDER="0">n";
  3.  //changed this to a for loop so we can use the number of rows
  4.  for($i = 0; $i < $num_rows; $i++) {
  5.     $row = mysql_fetch_array($result);
  6.     if($i % $cols == 0) {
  7.         //if there is no remainder, we want to start a new row
  8.         echo "<TR>n";
  9.     }
  10.     echo "<TD>" . $row['id'] . "</TD>n";
  11.     if(($i % $cols) == ($cols - 1) || ($i + 1) == $num_rows) {
  12.         //if there is a remainder of 1, end the row
  13.         //or if there is nothing left in our result set, end the row
  14.         echo "</TR>n";
  15.     }
  16.  }
  17.  echo "</TABLE>n";


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?

Reply With Quote
  #2  
Old November 20th, 2003, 02:04 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
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.

Reply With Quote
  #3  
Old November 21st, 2003, 11:32 AM
soulskater soulskater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 13 soulskater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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???

Reply With Quote
  #4  
Old November 27th, 2003, 09:27 AM
soulskater soulskater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 13 soulskater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Error on Tutorial example.

Does anyone have a solution on this, because i don't it's very strange.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOtherTutorials > Error on Tutorial example.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway