techiefreak05 Posted September 11, 2006 Share Posted September 11, 2006 i have a code that gets all your friends from the "friends": table... and then takes that info and gets all the bulletins from the "bulletins" table and then shows all the bulletins posted by all your friends... .. but its not working.. no error.. its just the bulletins are not showing up ...[code]<?php$query="SELECT * FROM friends WHERE `username` = '$_SESSION[username]' AND `accepted` = 'yes'";$result=mysql_query($query);while($array=mysql_fetch_assoc($result)){$poster = $array['friend'];$user = $_SESSION[username];if(!isset($_GET['bulletinPage'])){ $Bpage = 1; } else { $Bpage = $_GET['bulletinPage']; } $max_results = 5; $from = (($Bpage * $max_results) - $max_results); $query="SELECT * FROM `bulletins` WHERE `from` = '$poster' ORDER by 'id' DESC LIMIT $from, $max_results";$result=mysql_query($query);while($array=mysql_fetch_assoc($result)){echo "<table bgcolor=#99CCFF width=200><tr bgcolor=#548099><td height=28><b><font color=white>From: <a href='getInfo.php?user=" . $array['from'] . "'>" . $array['from'] . "</a></b><br><b>Date: </b>" .$array['date']; echo "</b></font></td></tr></table>"; echo "<table bgcolor=#99CCFF width=200><tr bgcolor=#356B8B><td height=25><center><a href=\"showBulletin.php?id=".$array['id']."\">Subject: ".$array['subject']."</a></center>"; echo "</td></tr></table><hr>"; }}[/code]some of the code in there is the pagination code.... Quote Link to comment Share on other sites More sharing options...
btherl Posted September 11, 2006 Share Posted September 11, 2006 It's good practice to check mysql_query() for errors.[code]$result = mysql_query($query);if ($result === false) die("Mysql error: " . mysql_error() " on query $query\n");[/code]If that doesn't work, then print out your queries before executing them. It's likely there's a problem with one of them. Quote Link to comment Share on other sites More sharing options...
Jenk Posted September 11, 2006 Share Posted September 11, 2006 Where do you start the session, and where do you check that $_SESSION['username'] has a value?Also, learn to use JOIN's and not nested mysql_query()'s. Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted September 11, 2006 Author Share Posted September 11, 2006 the answer to both ur questions:: [b]earlier in the code[/b] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.