Jump to content

[SOLVED] can anyone tell me whats wrong here :|


jesushax

Recommended Posts

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"

} 

}

?>

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";

} 

}

?>

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 :)

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.