Re: [PHP-DB] Re: What's wrong with this code?
Sorry all, my mail program has been sending messages to the sender. Sorry...Taj Jean-Christian Imbeault wrote: Shoulder To Shoulder Farm wrote: 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]');) Maybe it's a typo but all you $_POST vars are wrong. They should be $_POST[var] not $_POST[var] as you have them. Jc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Re: What's wrong with this code?
Try concencating (however you spell it) the variables...i try not to put arrays inside of strings, rather i do the following below. Oh yeah, and you have two things that say VALUES (...) ...maybe ive missed this over the years, but i thought you put the fields inside parenthesis without anything before it, then you stick the VALUES() after it, like so: $sql = INSERT INTO prod (Name, ShortDesc, LongDesc, PriceOZ, PriceLB, URLOX, URLLB, IMG) values(' . $_POST['Name'] . ',' . $_POST['ShortDesc'] . ...); If you dont like using the concencating method, you could do this as well: $sql = INSERT INTO prod (Name, ShortDesc, LongDesc, PriceOZ, PriceLB, URLOX, URLLB, IMG) values('{$_POST['Name']}','{$_POST['ShortDesc']}',.); David Balatero [EMAIL PROTECTED] - Original Message - From: Shoulder to Shoulder Farm [EMAIL PROTECTED] To: PHP Database List [EMAIL PROTECTED] Sent: Monday, September 02, 2002 7.57 AM Subject: Re: [PHP-DB] Re: What's wrong with this code? Sorry all, my mail program has been sending messages to the sender. Sorry...Taj Jean-Christian Imbeault wrote: Shoulder To Shoulder Farm wrote: 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]');) Maybe it's a typo but all you $_POST vars are wrong. They should be $_POST[var] not $_POST[var] as you have them. Jc -- 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] Re: What's wrong with this code?
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... 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 Well, hard to say as we don't have your db to run it against. You might try using mysql_error() immediately after the mysql_query to get an error message from mysql that will help you, or help us help you. -- David Robley Temporary Kiwi! Quod subigo farinam -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: What's wrong with this code?
Shoulder To Shoulder Farm wrote: 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]');) Maybe it's a typo but all you $_POST vars are wrong. They should be $_POST[var] not $_POST[var] as you have them. Jc -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php