NanaFreak
Scripting Contest Winner
Posts: 1476 Reputation: 53
32 / /
Joined: Jul 2006
|
RE: Who knows something about SQL and PHP
quote: Originally posted by Exca
SHOUT.PHP
code: <?
// BEKIJK README VOOR DETAILS
require("config.php");
if (!empty($_POST['name']) && !empty($_POST['shout'])) {
$name=strtoupper($_POST['name']);
$shout=strtoupper($_POST['shout']);
$now=time();
$sql=mysql_query("INSERT INTO shoutbox (id,date,name,shout) VALUES ('','$now','$name','$shout')")
or die("&error=ERROR: ERROR INSERTING&content=SEE ERROR DETAILS");
echo"&error=RECEIVED YOUR SHOUT";
}
else {
$sql=mysql_query("SELECT * FROM shoutbox ORDER BY id DESC LIMIT 50")
or die("&error=ERROR: WRONG QUERY&content=SEE ERROR DETAILS");
if(mysql_numrows($sql)==0) {
echo"&error=ERROR: RETURNED EMPTY&content=SEE ERROR DETAILS";
}
else {
while($row=mysql_fetch_array($sql)) {
$content="$content"."$row[name]:\n$row[shout]\n\n";
}
echo"&content=$content";
}
}
?>
there is your problem
|
|