I’ve recently been playing around with PHP in an almost vain attempt to learn it. For the past 2 days I have been fighting w/ this very simple script to insert some data into a database, and I have no idea why it doesn’t. If someone could easily point out the problem, it’d be much appreciated.
<?php
require("config.php");
mysql_connect($mysql["host"], $mysql["user"], $mysql["pass"]) or die("MySQL connection failed. Some info is wrong");
$table="members";
$user=$_POST['username'];
$passwd=$_POST['pass'];
$mail=$_POST['email'];
$query = "INSERT INTO $table (id, username, pass, email) VALUES('','$user', '$passwd', '$mail')";
mysql_query($query) or die("Could not insert information into table");
echo "<br> Content was sucessfully inserted";
?>
If you want to see what it does, just press the Submit button here.
It just outputs the error message “Could not insert information into table”
I’ve used this script before and it has worked. So I am at a loss as to know what to do. Help is much appreciated. Thanks!