Hello Max,

Monday, November 15, 2004, 6:26:43 PM, you wrote:

MK> } else if ($_POST[FirstName] != "") {

Where you use $_POST you should have the syntax as follows:

$_POST['var']

(note the quote marks)

Without them, PHP is going to think you're passing in a constant
called "FirstName" (etc) which of course you're not.

MK>         $add_table = "INSERT into table values (NULL, '$_POST[FirstName]',
MK>                 '$_POST[LastName], '$_POST[Address], '$_POST[City], 
'$_POST[State],
MK>                 '$_POST[Zip], '$_POST[phone],'$_POST[email])";
MK>         mysql_query($add_table) or die(mysql_error());

You really *really* shouldn't insert POST data directly into a table,
for reasons please see Chris's very good read on PHP Security here:

http://shiflett.org/php-security.pdf

But back to the question in hand - try and see what has happened,
extend your code a bit at the end:

mysql_query($add_table);

if (mysql_error($conn))
{
   echo "Something bad happened with MySQL: " . mysql_error($conn);
}
else
{
    echo "There was no SQL error";
}

Try outputting the SQL (echo $add_table) and then pasting it into
PHPMyAdmin or a MySQL command session and see what it gives you. If
that works fine, the error is in the communication with the MySQL
server (authentication perhaps) and not the SQL itself.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to