note 119347 deleted from function.mysql-fetch-assoc by cmb
| From: | cmb@php.net | Date: | Wed, 18 May 2016 14:04:51 +0000 |
| Subject: | note 119347 deleted from function.mysql-fetch-assoc by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205509@lists.php.net to get a copy of this message | ||
Note Submitter: MojeJmeno
----
<html>
<body>
<form method="POST">
<input type="text" name="title">
<textarea name="content"></textarea>
</form>
<?
$db = mysql_connect('localhost','username','password');
$data = filter_input_array(INPUT_POST);
if(sizeof($data) > 0)
{
$title = $data["title"];
$content = $data["content"];
mysql_query("INSERT INTO tablename (title,content)
VALUES('$title','$content')");
}
$result = mysql_query("SELECT * FROM tablename");
while($row = mysql_fetch_assoc($result))
{
echo "<div>";
echo "<h3>$row['title']</h3>";
echo "<p>$row['content']</p>"
}
?>
</body>
</html>