[PHP-DB] Input to DB from form
I'm trying to input that data entered into a form into a table in my DB. Here is the code I have. $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft,$db); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); This is embedded in an HTML document and loads the entire document, but doesn't add the information to the table. Any help would be wonderful! James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DB] Input to DB from form
Are you even calling the mysql_query() function? Should look something like this: Mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); Mysql_query($sql); --Ryan -Original Message- From: James Kupernik [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 03, 2002 01:52 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Input to DB from form I'm trying to input that data entered into a form into a table in my DB. Here is the code I have. $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft,$db); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); This is embedded in an HTML document and loads the entire document, but doesn't add the information to the table. Any help would be wonderful! James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Input to DB from form
check if all your fields are indeed strings (char, varchar) and not numbers. Mihail Bota On Thu, 3 Jan 2002, James Kupernik wrote: I'm trying to input that data entered into a form into a table in my DB. Here is the code I have. $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft,$db); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); This is embedded in an HTML document and loads the entire document, but doesn't add the information to the table. Any help would be wonderful! James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Input to DB from form
You have to execute the query, like so: mysql_query( $sql ); placing this after the code which creates $sql. Also check that your datatypes match, it's often worthwhile echoign $sql so you can see exactly what it contains. Regards - Miles Thompson At 01:52 PM 1/3/2002 -0500, James Kupernik wrote: I'm trying to input that data entered into a form into a table in my DB. Here is the code I have. $db = mysql_connect(localhost,cloft,spring); mysql_select_db(countryloft,$db); $sql = INSERT INTO catalogreq (BFNAME,BLNAME,ADD1,ADD2,BCITY,BZIPA,BSTATE,BCTRY,BTELO,DATE) VALUES ('$BFNAME','$BLNAME','$BADD1','$BADD2','$BCITY','$BZIPA','$BSTATE','$BCTRY', '$BTELO','$TODAY'); This is embedded in an HTML document and loads the entire document, but doesn't add the information to the table. Any help would be wonderful! James -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]