[PHP-DB] What's wrong with this code?
Hi all, I'm running PHP4. What's wrong with this code: ? $db = mysql_connect(localhost, Taj, wyethia); mysql_select_db(s2s,$db); mysql_query(INSERT INTO prod VALUES ( 'Name', 'ShortDesc', 'LongDesc', 'PriceOZ', 'PriceLB', 'URLOZ', 'URLLB', 'IMG') VALUES ('$_POST[Name]', '$_POST[ShortDesc]', '$_POST[LongDesc], '$POST[PriceOZ', '$_POST[PriceLB]', '$_POST[URLOZ]', '$_POST[URLLB], '$_POST[IMG]');) ? This will wrap, but, it should work. TIA, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] What's wrong with this code?
Hi all, I'm running PHP4. What's wrong with this code: ? $db = mysql_connect(localhost, Taj, passwordhere); mysql_select_db(s2s,$db); mysql_query(INSERT INTO prod VALUES ( 'Name', 'ShortDesc', 'LongDesc', 'PriceOZ', 'PriceLB', 'URLOZ', 'URLLB', 'IMG') VALUES ('$_POST[Name]', '$_POST[ShortDesc]', '$_POST[LongDesc], '$POST[PriceOZ', '$_POST[PriceLB]', '$_POST[URLOZ]', '$_POST[URLLB], '$_POST[IMG]');) ? This will wrap, but, it should work. TIA, Taj -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] What's wrong with this code?
I'd use var inclusions like this; VALUES (' . $_POST['Name'] . ', that might help you // -Original Message- // From: Shoulder to Shoulder Farm [mailto:[EMAIL PROTECTED]] // Sent: Monday, 2 September 2002 11:42 AM // To: PHP Database List // Subject: [PHP-DB] What's wrong with this code? // // // Hi all, I'm running PHP4. What's wrong with this code: // // ? // // $db = mysql_connect(localhost, Taj, passwordhere); // // mysql_select_db(s2s,$db); // // mysql_query(INSERT INTO prod VALUES ( 'Name', 'ShortDesc', // 'LongDesc', // 'PriceOZ', 'PriceLB', 'URLOZ', 'URLLB', 'IMG') VALUES // ('$_POST[Name]', // '$_POST[ShortDesc]', '$_POST[LongDesc], '$POST[PriceOZ', // '$_POST[PriceLB]', '$_POST[URLOZ]', '$_POST[URLLB], '$_POST[IMG]');) // // ? // // This will wrap, but, it should work. // // TIA, Taj // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] What's wrong with this code?
Hi, I really need help, I wrote a function so that I can call for db user/password in an include file. It looks like this: // Connect to the database function db_connect(){ global $MYSQL_USERNAME, $MYSQL_PASSWORD, $DB, $HOST; $db = mysql_connect("$HOST","$MYSQL_USERNAME","$MYSQL_PASSWORD"); mysql_select_db("$DB",$db); } I have user/password/host variables inside a config file but for some reason when I include this into a php page when I test it, I get: Fatal error: Cannot redeclare db_connect() in /www/affiliate/include/functions.inc on line 7. Am I missing something because everything looks good to me. Emir. __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- 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] What's wrong with this code?
Hello... Try mysql_pconnect instead Dan -- From: Emir Musabasic Sent: Monday, March 26, 2001 9:34 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] What's wrong with this code? Hi, I really need help, I wrote a function so that I can call for db user/password in an include file. It looks like this: // Connect to the database function db_connect(){ global $MYSQL_USERNAME, $MYSQL_PASSWORD, $DB, $HOST; $db = mysql_connect("$HOST","$MYSQL_USERNAME","$MYSQL_PASSWORD"); mysql_select_db("$DB",$db); } I have user/password/host variables inside a config file but for some reason when I include this into a php page when I test it, I get: Fatal error: Cannot redeclare db_connect() in /www/affiliate/include/functions.inc on line 7. Am I missing something because everything looks good to me. Emir. __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- 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] What's wrong with this code?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] (Emir Musabasic) wrote: I have user/password/host variables inside a config file but for some reason when I include this into a php page when I test it, I get: Fatal error: Cannot redeclare db_connect() in /www/affiliate/include/functions.inc on line 7. Am I missing something because everything looks good to me. Try using include_once() instead of include(). You're probably inadvertantly re-including the file. In general, except where you're deliberately making multiple includes of the same file, it's a good idea to get in the habit of using include_once() or require_once() to save yourself from surprises like this. -- CC -- 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]