i have this facebook looking news feed right here but the thing is the body text wont show up when its submitted, yet when i look in the database its there!
- Code:
function displayPosts($username,$limit=0){
global $database, $session;
$user_string = "'".implode("','",$username)."'";
$extra = " AND user_id IN ($user_string)";
if ($limit > 0){
$extra = "LIMIT $limit";
} else {
$extra = '';
}
$q = "SELECT user_id,body,stamp "
."FROM ".TBL_POSTS." WHERE user_id IN ($user_string) ORDER BY stamp DESC $extra";
echo $q;
// This query is for own posts only
//$q = "SELECT body,stamp "
// ."FROM ".TBL_POSTS." WHERE user_id = '$username' ORDER BY stamp DESC";
$result = $database->query($q);
//error checkx $result = mysql_query ($q) or die(mysql_error());
/* Error occurred, return given name by default */
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
echo "Error displaying info";
return;
}
if($num_rows == 0){
echo "There are no status updates.";
return;
}
/* Display table contents */
echo "[table align='"left"' border='"0"' cellspacing='"0"' cellpadding='"5"']";
for($i=0; $i<$num_rows; $i ){
$datetime = mysql_result($result,$i,"stamp");
echo "[tr valign="top"]\n";
echo "[td]".mysql_result($result,$i,"user_id")."[/td]\n";
echo "[td]".mysql_result($result,$i,"body")."
\n";
echo $datetime."[/td]\n";
echo "[/tr]\n";
}
echo "[/table]
";
}