MySQL 5.0.41
Actually Sock, I think I found the problem. You might actually be laughing soon....
PHP Code:
$db = new mysqli ('localhost', 'user', 'pass', 'dir', 'address', 'phone', 'email');
I think thats the problem. Shouldn't that be 'localhost', 'ybh305_clients', 'my_password', 'clients'
localhost->db name->db password->which table ?
I've redone the code to mysql instead, it seems easier to my eyes to read it and understand it better.
PHP Code:
<?php
// Variables
$user = $_POST['user'];
$pass = $_POST['pass'];
$dir = $_POST['dir'];
$address = $_POST['address'];
$phone = $_POST['phone'];
$email = $_POST['email'];
// Connect to db
$db = mysql_connect(localhost, ybh305_clients, mypassword) or die(mysql_error());
mysql_select_db(ybh305_clients, $db);
//Insert info
$sql = "INSERT INTO clients(user, pass, dir, address, phone, email)";
$sql .= "values('$user, $pass, $dir, $address, $phone, $email')";
//Run it
$rq = mysql_query($sql, $db) or die(mysql_error());
//Show O.K. message
if ($rq){
echo 'Client has been added to your data base';
}
?>
I'm getting a MySQL error when I run it
PHP Code:
Column count doesn't match value count at row 1
I'm not sure what that means. My rows are as follows in my table:
user
pass
dir
address
phone
email