At 05:17 29.01.2003, Sunfire said: --------------------[snip]-------------------- >hi ... > >im having a little problem with mysql_query("insert into members >('$company', '$name1', '$name2', '$address1', '$address2', ''$ac1', '$ext2', >'$num1', '$ac2', '$ext2', '$num2', '$city', '$state', '$zip', '$desc', >'$flags')"); > >for some reason those variables are empty by the time they get into the >table...
Are these variables received by handling a form submit? You should use the $_REQUEST array if you have register_globals off: mysql_query("insert into members ('{$_REQUEST['company']}', '{$_REQUEST['name1']}', '{$_REQUEST['name2']}', '{$_REQUEST['address1']}', '{$_REQUEST['address2']}', '{$_REQUEST['ac1']}', '{$_REQUEST['ext2']}', '{$_REQUEST['num1']}', '{$_REQUEST['ac2']}', '{$_REQUEST['ext2']}', '{$_REQUEST['num2']}', '{$_REQUEST['city']}', '{$_REQUEST['state']}', '{$_REQUEST['zip']}', '{$_REQUEST['desc']}', '{$_REQUEST['flags']}')"); Two other 'littles' I see: - your original statement comes with two single quotes before "$ac1", this will break the query if it's not a message typo here. - the "ext2" value is inserted twice - I personally prefer to explicitly name the columns on any insert, even if I populate all columns. If by chance your table structure will change (using ALTER TABLE) your insert statement will break. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php