Posted on Friday 3rd August 2007 at 02:05 PM
Hey, I recoded my own shoutbox, and it only displays one post, but there are two posts in the database:
Shadow, you said to get rid of the limit in the shoutbox and it still did not work.
Anybody have any ideas? Thanks!
Code
<?php
session_start();
include("config.php");
include("bbcode12.php");
if($logged[username]) {
switch($_GET[page]) {
default:
echo "<script language="JavaScript">
function refresh() {
setTimeout('dorefresh()', 30000);
}
function dorefresh() {
window.location.reload();
}
</script><body onLoad='refresh()'>";
$getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15");
$getnum = mysql_num_rows($getcount);
if($getnum == 0) {
echo "There are no shoutbox posts.";
}
else {
$getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15");
$t = mysql_fetch_array($getcount);
echo "<a href='members.php?user=$t[by]'>$t[by]</a>: $t[message]";
}
break;
case 'post':
if($logged[username] && $_POST[tag]) {
if(empty($_POST[message])) {
echo "You need to enter a message to submit!";
} else {
$user = $logged[username];
$msg = htmlspecialchars(stripslashes($_POST[message]));
$insert = mysql_query("INSERT INTO `shoutbox` (`by`, `message`) VALUES ('$user','$msg')");
echo "<meta http-equiv='refresh' content='0;url=box.php'>Shout Posted.";
}
}
if($logged[username] && !$_POST[tag]) {
echo "Unknown error, please go back and try again!";
}
break;
}
} else {
echo "Sorry, you must be logged in to post!";
}
?>
session_start();
include("config.php");
include("bbcode12.php");
if($logged[username]) {
switch($_GET[page]) {
default:
echo "<script language="JavaScript">
function refresh() {
setTimeout('dorefresh()', 30000);
}
function dorefresh() {
window.location.reload();
}
</script><body onLoad='refresh()'>";
$getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15");
$getnum = mysql_num_rows($getcount);
if($getnum == 0) {
echo "There are no shoutbox posts.";
}
else {
$getcount = mysql_query("SELECT * FROM `shoutbox` ORDER BY `id` LIMIT 0, 15");
$t = mysql_fetch_array($getcount);
echo "<a href='members.php?user=$t[by]'>$t[by]</a>: $t[message]";
}
break;
case 'post':
if($logged[username] && $_POST[tag]) {
if(empty($_POST[message])) {
echo "You need to enter a message to submit!";
} else {
$user = $logged[username];
$msg = htmlspecialchars(stripslashes($_POST[message]));
$insert = mysql_query("INSERT INTO `shoutbox` (`by`, `message`) VALUES ('$user','$msg')");
echo "<meta http-equiv='refresh' content='0;url=box.php'>Shout Posted.";
}
}
if($logged[username] && !$_POST[tag]) {
echo "Unknown error, please go back and try again!";
}
break;
}
} else {
echo "Sorry, you must be logged in to post!";
}
?>
Shadow, you said to get rid of the limit in the shoutbox and it still did not work.
Anybody have any ideas? Thanks!