jesushax Posted March 17, 2009 Share Posted March 17, 2009 hi all, below is my code, which just returns a blank page, the sql is working becuase i can remove everything below $i = 0; and get results from echoing the sql thanks <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'); $sql = mysql_query("SELECT * FROM tblLatest ORDER BY ArticleDateAdded DESC LIMIT 3") or die(mysql_error()); $i = 0; while($article = mysql_fetch_array($sql)) { ++$i; if ($i % 2 == 0) // Here are your even records { echo'<div class="front-box-middle">'."/n" echo'<h2>'.$article["ArticleTitle"].'</h2>'."/n" echo'<div><img src="/latest/uploads/thumbs/'.$article["ArticleImage"].'" alt="'.$article["ArticleImage"].'" /></div>'."/n" echo'<p>'.$article["ArticleBrief"].'</p>'."/n" echo'</div>'."/n" } else // Here are your odd records { echo'<div class="front-box">'."/n" echo'<h2>'.$article["ArticleTitle"].'</h2>'."/n" echo'<div><img src="/latest/uploads/thumbs/'.$article["ArticleImage"].'" alt="'.$article["ArticleImage"].'" /></div>'."/n" echo'<p>'.$article["ArticleBrief"].'</p>'."/n" echo'</div>'."/n" } } ?> Quote Link to comment Share on other sites More sharing options...
Renlok Posted March 17, 2009 Share Posted March 17, 2009 your missing loads of semicolons <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'); $sql = mysql_query("SELECT * FROM tblLatest ORDER BY ArticleDateAdded DESC LIMIT 3") or die(mysql_error()); $i = 0; while($article = mysql_fetch_array($sql)) { ++$i; if ($i % 2 == 0) // Here are your even records { echo'<div class="front-box-middle">'."/n"; echo'<h2>'.$article["ArticleTitle"].'</h2>'."/n"; echo'<div><img src="/latest/uploads/thumbs/'.$article["ArticleImage"].'" alt="'.$article["ArticleImage"].'" /></div>'."/n"; echo'<p>'.$article["ArticleBrief"].'</p>'."/n"; echo'</div>'."/n"; } else // Here are your odd records { echo'<div class="front-box">'."/n"; echo'<h2>'.$article["ArticleTitle"].'</h2>'."/n"; echo'<div><img src="/latest/uploads/thumbs/'.$article["ArticleImage"].'" alt="'.$article["ArticleImage"].'" /></div>'."/n"; echo'<p>'.$article["ArticleBrief"].'</p>'."/n"; echo'</div>'."/n"; } } ?> Quote Link to comment Share on other sites More sharing options...
dgoosens Posted March 17, 2009 Share Posted March 17, 2009 as he ^ said by the way... the linebreak is \n... not /n Quote Link to comment Share on other sites More sharing options...
jesushax Posted March 17, 2009 Author Share Posted March 17, 2009 whoops :| such an idiot mistake :| its the my keyboard that makes me do line breaks the wrong way my / and \ are next to eachother and i sometimes press wrong one and i just copied and pasted the wrong one lots! lol thanks for the hlep any guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.