Page 1 of 1

Newbie Question

Posted: Sun Mar 06, 2005 2:59 pm
by anthony88guy
I am making a shout out box for my website. I downloaded a free shoutout and looked at how they did it, and now i have a question. In a database you need a table to store variables correct? Look at this:

Code: Select all

<?
include "cfg.php";
print "<html>
	<head>
	<title>Shout it...</title>
    <link rel='stylesheet' type='text/css' href='style.css'>";
print "</head>
	<body>";
echo "<table>
<form action='$php_self' method='post' name='form'>
<tr><td>Name:</td> <td><input type='text' value='$name' name='name' size=18 maxlength='100'></td></tr><br />
<tr><td>Homepage:</td> <td><input type='text' value='$site' name='site' size=18 maxlength='100'></td></tr><br />
<tr><td>E-mail:</td> <td><input type='text' value='$email' name='email' size=18 maxlength='100'></td></tr><br />
<tr><td>Message:</td> <td><input type='text' value='message' name='message' size=18 maxlength='100'></td></tr><br />
<tr><td><input type='submit' name='submit' value='Shout'></td>
<td><input type='reset' name='reset' value='Reset'></td></tr>
</form>
</table>";

mysql_connect("$dbhost","$dbuser","$dbpass");
mysql_select_db("$dbname");
if($submit)
&#123;
   $time=date("h:ia d/j/y");
   $result=MYSQL_QUERY("INSERT INTO xx_shoutbox (id,name,message,time,site,email)".
      "VALUES ('NULL','$name', '$message','$time','$site','$email')");
&#125;
$result = mysql_query("select * from xx_shoutbox order by id desc limit $mnumber");
while($r=mysql_fetch_array($result))
&#123;		
   $time=$r&#1111;"time"]; 
   $id=$r&#1111;"id"];
   $message=$r&#1111;"message"];
   $name=$r&#1111;"name"];
   $site=$r&#1111;"site"];
   $email=$r&#1111;"email"];
 echo '<b>'.'<a href="mailto:'.$email.'">m@il</a>'.' - '.'<a href="'.$site.'" target="_blank">'.$name.'</a>'.'</b>'.'<br />';
 echo $message.'<br />';
&#125;
?>

Posted: Sun Mar 06, 2005 3:00 pm
by anthony88guy
my bad i was looking over it and i think that xx_shoutbox is the table.