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
https://forums.phpfreaks.com/topic/74366-solved-help-data-from-table/
Share on other sites

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.