Enter a piece of news there and hit the refresh button. Hit refresh as often as you want to! News will just keep popping up and up and up and up.
This is the code for the entire page:
Code: Select all
<?
include("config.php");
if($_POSTї'submit']) {
//Create News
$sql = "insert into IamJim_news (headline, news, posted_by) values('$headline' , '$news' , '$user')";
$query = mysql_query($sql);
}
//Print the News
$sql = "select * from IamJim_news where id != 0";
$query = mysql_query($sql);
if($query) {
while($data = mysql_fetch_assoc($query)) {
$headline = $dataї'headline'];
$date = $dataї'postdate'];
$news = $dataї'news'];
$poster = $dataї'posted_by'];
$id = $dataї'id'];
echo "<table cellpadding=5 cellspacing=0 border=0><tr><td>$headline</td><td>$date</td><td>$poster</td><td width=50><a href="http://www.empiregaming.net/iamjim/news/MySQL-PHP/editnews.php?action=edit&id=$id">Edit</a></td><td width=50><a href="http://www.empiregaming.net/iamjim/news/MySQL-PHP/editnews.php?action=delete&id=$id">Delete</a></td></tr></table>";
}
}
?>
<form method=post action="<?=$PHP_SELF?>"><table cellpadding=0 cellspacing=0 border=0><tr><td><input type="text" name="user" value="Username"></td></tr><tr><td><input type="text" name="headline" value="Headline"></td>
</tr><tr><td><textarea name="news" cols=20 rows=5>Post News Here</textarea></td></tr><tr><td><input type="submit" name="submit"></table></form>Any ideas on how to stop this constant insertion?
Thanks for help!