Jump to content

[SOLVED] Help, Data From Table


oasmar

Recommended Posts

 

<?php
$query = "SELECT * FROM $links WHERE originaldir = $dirlink ORDER BY displayorder ASC"; 
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$redirtable = $row['redirtable'];
$redirid = $row['redirid'];
$pagetype = $row['pagetype'];
if(!empty($redirid)){

require 'article.php'; 

}
}
?>

 

article.php

<?php
$result = mysql_query("SELECT * FROM $article WHERE articleid = $redirid");
while($row = mysql_fetch_array($result)){
echo $containerbegin;
echo'<table width="100%" border="0" cellpadding="0" cellspacing="0" >
  <tr>
    <td><h1>'.$row['header'].'</h1><br /></td>
  </tr>
  <tr>
    <td><span style="font-size:12px; color: #FFFFFF; text-align:left">'.$row['content'].'</span></td>
  </tr>
  <tr>
    <td><br /><span style="font-size:12px; color: #FFFFFF; text-align:left">Posted by '.$row['poster'].' on '.$row['postdate'].'.</span></td>
  </tr>
</table>';
echo $containerend;
}
?>

 

The script kinda works, the only problem is that the first file should have several repitions of the article.php but for some reason it will only display article.php once. However, i change "include 'article.php';" with "echo 'test';" it will display the word test 4 times.

The script should bring up article 4 times each one with a different post from the table $article.

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.