Apologies if this is a noobish mistake. Been working on learning PHP and just trying to insert some data into a mysql table, but whenever I do so, it inserts blank data. Anyone know where I'm going wrong please?
PHP Code:
<?php
$user = $_POST["username"];
$pwd = $_POST["password"];
$pwd2 = $_POST["password1"];
$email = $_POST["email"];
$inputcheck = $_POST["inputcheck"];
$error;
$dbres = mysql_connect('localhost','root');
$select = mysql_select_db("sitename", $dbres);
$sql = mysql_query( "INSERT INTO ver_users
(username, password, email)
VALUES ('$user', '$pwd', '$email')
");
Obviously the script is much bigger but the rest should not affect it (I hope!).
The structure of table in mysql looks like thus:
Also if I try to use
PHP Code:
$_POST["username"]
rather than the variables, it brings up an error regarding datatypes, yet the data submitted is a string of 5 or 6 characters long.
Edit: If I settype() to a string it inserts a value of 1 for username (if input on form is, for examle, 'ssss'), so something is going wrong somewhere :/