Select a table inside a db
| From: | zeroked | Date: | Tue, 24 Dec 2002 16:10:00 +0000 |
| Subject: | Select a table inside a db | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24358@lists.php.net to get a copy of this message | ||
Hi I am a newbie to PHP so please help
How do I add information into my mysql db?
I have a db called sitedb and I want to insert datat into my news table
inside my sitedb.
code snippet:
<html><head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="<?=$PHP_SELF;?>" method="post" name="news">
<p> NAME
<input name="author" type="text" id="author"
maxlength="30">
</p>
<p> your news
<textarea cols="50" rows="10" name="body" type="text"
id="body"
maxlength="60"> </textarea>
</p>
<?
include ("broadcast.inc");
?>
<p><input type="submit" name="Submit"
value="Submit"></p>
<?
// this inserts the data into the table news, and the rows within that table
mysql_query("INSERT INTO news (author, posted, body) VALUES($author,
$posted, $body) ");
// Close the connection
mysql_close();
?>
</form>
</body>
</html>