I'm sure this issue has went through here before, I saw it all over the internet but nothing really made sense to me. I'm pretty novice at using phpMyAdmin, and PHP + MySql.
I have a PHP File for inserting information, that looks like this.
<form action="db.php" target="_blank" method="post">
Name <input type="text" name="name">
Year <input type="text" name="year">
Game <input type="text" name="game">
<input type="submit" value="send to server">
Then I have my PHP file to INSERT INFO into the database.
$host = "127.0.0.1";
$user = "root";
$pass = "admin";
$name = $_POST["name"];
$year = $_POST["year"];
$game = $_POST["game"];
$con = mysql_connect($host, $user, $pass)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br><br>";
$select = mysql_select_db("jett61",$con)
or die("Could not select database");
echo "Database selected<br>";
mysql_query($select,"INSERT INTO members (name, year, game) VALUES ($name, $year, $game)")
or die("Insertion into database failed");
echo "Information inserted into database<br>";
And my output looks like the following:
Connected to MySQL
Warning: mysql_query() expects parameter 2 to be resource, string given in C:\xampp\htdocs\db.php on line 17
Insertion into database failed
I'm a noob at this, like I said. Any help will be appreciated, thanks.