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"

} 

}

?>

Link to comment
Share on other sites

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

} 

}

?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.