Okay, here's the situation. I have a function that is simply getting the infomation of a mysql table and displaying it. When $number == 0, it echos no comment, when $number > 0, it performs a for loop. But when call it to a php file that contains a layer, it works wierd. When $number==0, the code works fine, but when $number> 0, the for loop doesnt work. it doesnt diplay anything, no errors or nothing, and I dont have the anti-error things going either. but when I look at the file by itself, it works fine, the only thing is it doesnt work when it's called. someone please help!!
Here's the code for the file being called:
if (!isset($postid)) die ("No comments");
$getpost=mysql_query("select *, date_format(date,'%M %D, %Y') as dated from TABLE where table_id = '$postid' order by
date desc");
$number=mysql_num_rows($getpost);
function postpost() {
global $postid, $number, $getpost;
for ($i=0; $i<$number; $i++) {
$name=mysql_result($getpost,$i,'name');
$date=mysql_result($getpost,$i,'dated');
$comment=mysql_result($getpost,$i,'comment');
$url=mysql_result($getpost,$i,'url');
$email=mysql_result($getpost,$i,'email');
echo "
<table width='100%' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td> <font size=2><a href='mailto:$email45'>$name45</a> | <a href='goto.php?url=$url45' TARGET='new'>[URL]</a>
</font></td> HELLO THERE
</tr>
<tr><td> <font size=2> | $date45 | </font>
</td></tr>
<tr>
<td><font size=2>$comment45</font></td>
</tr>
</table>
";
}}
switch ($number) {
case 0:
echo ("There are no comments");
break;
case ($number > 0):
postpost();
break;
default:
postpost();
break;
}
here's the code on the file that's calling it.
<div id='comments' style='position:absolute; width:282px; height:152px; z-index:16; left: 0px; top: 0px'> include ('shared/viewnewspost.php'); </div>