iCodeZ
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Simple shoutbox.

2 posters

Go down

Simple shoutbox. Empty Simple shoutbox.

Post by {#LAG#} Insane Wed Jun 04, 2008 9:03 pm

Ok here we go.

Go into PHP my admin and make a table called: shoutbox
Then make the fields:

id
username
message



Here we are making the shoutbox color fields, and tables.

shoutbox.php


PHP Code:
//Make sure you have the database called "config.php"


?>

Admin CP |
View Full Shoutbox

| Refresh




$result = mysql_query("SELECT * FROM shoutbox order by id DESC LIMIT 5")
or die(mysql_error());
echo "

";
// keeps getting the next row until there are no more to get
while($row = mysqf_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "";
}

echo "
";
echo $row['username']; echo ": "; echo $row['message'];
echo "
";

echo "
";
?>

 




All that does is displays the shoutbox but we need it to add the shouts and display the fields.

sfield.php


PHP Code:











Now here is what adds the shout:

addshout.php


PHP Code:







$username = $_POST['username'];
$message = $_POST['message'];

mysql_query("INSERT INTO shoutbox(username, message) VALUES('$username', '$message')")
or die(mysql_error()); ?>


That will automatically redirect you to index.php which I'm guessing your s box will be on the index like mine. You may change the location to where you want it.

Thanks.

{#LAG#} Insane
Admin
Admin

Number of posts : 29
Age : 27
Location : Your Mums WoW Server.
Registration date : 2008-06-04

http://www.icodez.co.nr

Back to top Go down

Simple shoutbox. Empty Re: Simple shoutbox.

Post by jub jub Wed Jun 04, 2008 9:28 pm

awesome script i may use pirat jokes i dunno!
jub jub
jub jub
Admin
Admin

Number of posts : 36
Age : 28
Registration date : 2008-06-03

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum