Page 2 of 2
Posted: Mon May 14, 2007 9:52 am
by Mirux
Code: Select all
$insert = "INSERT INTO members ('loginid', 'password', 'firstname', 'surname', 'email', 'trade', 'address1', 'address2', 'address3', 'address4', 'postzip', 'country', 'yearsexp', 'about') VALUES ...
Somehow, when I use '' for the table fields, like 'loginid', 'password', etc. it gave me error once. If the code doesn't work for you, just delete the single quotes. Just use them for the VALUES.
Posted: Mon May 14, 2007 1:45 pm
by toby_c500
Awesome. That has help Ole. Worked a treat. An oversight on my part.
Thank you all for you help.
The form works PHP-wise but the data does not enter into my database. The next issue to sort out.
I'm slowly learning.
Thanks again. I'm off to read up on phpmyadmin.
Toby
Posted: Mon May 14, 2007 5:17 pm
by RobertGonzalez
DO NOT DO THIS:
Mirux wrote:Code: Select all
$insert = "INSERT INTO members ('loginid', 'password', 'firstname', 'surname', 'email', 'trade', 'address1', 'address2', 'address3', 'address4', 'postzip', 'country', 'yearsexp', 'about') VALUES ...
Use backticks instead for field names, database names and table names.
Code: Select all
<?php
$sql = "INSERT INTO `tableName` (`field1`, `field2`) VALUES ($unquotedIntVal, '$quotedStringVal')";
?>
Posted: Tue May 15, 2007 12:43 pm
by toby_c500
Thanks Everah.
I will give that a go.