46
Help / Gun projectiles not coming
« on: January 31, 2010, 06:44:34 PM »
There are some guns that aren't shooting. Why not?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
<form action="PHPTest.php" method="post">
Username: <input type="text" name="user" />
<br/>
Message: <input type="text" name="msg" />
<br/>
<input type="submit" value="Speak up" />
</form>
<br/>
MySQL Code<?php
$con = mysql_connect("localhost:3306");
if(!$con)
{
die('Failed to conect: ' . mysql_error());
}
if(!mysql_query("CREATE DATABASE testDB",$con))
{
echo('Failed to create database: ' . mysql_error());
}
mysql_select_db("testDB",$con);
$sql = "CREATE TABLE Messages ( msgID int NOT NULL AUTO_INCREMENT, PRIMARY KEY(msgID), Message tinytext, User tinytext, )";
mysql_query($sql,$con);
$sqlTwo = "INSERT INTO Messages (Message, User) VALUES ('$_POST[msg]','$_POST[user]')";
if(!mysql_query($sqlTwo,$con))
{
die('Error: ' . mysql_error());
}
$result = mysql_query("SELECT * FROM Messages");
while($row = mysql_fetch_array($result))
{
echo $row['User'] . ": " . $row['msg'];
echo "<br />";
}
?>