Why isnt the information going into the MYSQL dtaabase?

Soldato
Joined
10 May 2004
Posts
3,759
Location
East Yorkshire, UK
Hi

I am using this code to send my form into a MYSQL database

Code:
    <?php
  } else {
  $email = $_POST['email'];
  $username = $_POST['username'];
  $password = $_POST['password'];
  $titles = $_POST['titles'];
  $forename = $_POST['forename'];
  $othernames = $_POST['othernames'];
  $addressline1 = $_POST['addressline1'];
  $addressline2 = $_POST['addressline2'];
  $addressline3 = $_POST['addressline3'];
  $city = $_POST['city'];
  $county = $_POST['county'];
  $postcode = $_POST['postcode'];
  $homenumber = $_POST['homenumber'];
  $mobile = $_POST['mobile'];
  $credit = $_POST['credit'];
  $creditnumber = $_POST['creditnumber'];
  $sortcode = $_POST['sortcode'];
  mysql_query("INSERT INTO 'form' (email, username, password, titles, forename, othernames, addressline1, addressline2, addressline3, city, county, postcode, homenumber, mobile, credit, creditnumber, sortcode) VALUES ('$email', '$username', '$password', '$titles', '$forename', '$othernames', '$addressline1', '$addressline2', '$addressline3', '$city', '$county', '$postcode', '$homenumber', '$mobile', '$credit', '$creditnumber', '$sortcode')");
  echo "Thank You! You have sucessfully submitted for hosting from Infra-One Solutions";
  }
  ?>

however it will not go into the database, here is a link to the picture of the database



any ideas?
Thanks
 
this is what I used to connect to the database

Code:
<?php
$db_host = "localhost";
$db_user = "watotron_infraon";
$db_pwd = "12345";
$db_name = "watotron_infraone";
mysql_connect($db_host, $db_user, $db_pwd);
mysql_select_db($db_name);
?>


EDIT]
Tried inserting manually in PHP MYADMIn, I can insert data fine
 
Last edited:
tntcode, I just tried using your connect code and get this error when i press submit

Warning: mysql_query(): Access denied for user 'watotron'@'localhost' (using password: NO) in /home/watotron/public_html/School/Project/InfraOne/signup.php on line 224

Warning: mysql_query(): A link to the server could not be established in /home/watotron/public_html/School/Project/InfraOne/signup.php on line 224
 
Im getting this now, cannot even fine $end
Parse error: syntax error, unexpected $end in /home/watotron/public_html/School/Project/InfraOne/signup.php on line 238

Just wondering if it would be easier if I post the full source code?


Freak_boy said:
why is your query havent got the $ signs infront of the variables? also you have to do '$email','$username' etec etc

in the database in PHPMYADMIN?
 
Ok that ones now sorted :)

but get this error when I submit

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''form' (email, username, password, titles, forename, othernames, addressline1, a' at line 1
 
Back
Top Bottom