Jump to content


Photo

Failing on insertion


  • Please log in to reply
3 replies to this topic

#1 cefalufr

cefalufr
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 May 2006 - 08:28 PM

It Keeps Failing on insertion, someone point of my error? DB information is above this code btw!

$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$state = $_REQUEST['state'];
$state = $_REQUEST['city'];
$zip = $_REQUEST['zip'];
$userid = $_REQUEST['userid'];

$query= 'INSERT INTO shipping_multiple (fname, lname, state, city, zip, userid) VALUES ("'.$fname.'","'.$lname.'","'.$state.'","'.$city.'","'.$zip.'","'.$userid.'")';
mysql_query($query) or die('Failed Insertion For New User');

$fname = $_REQUEST['fname'];
$lname = $_REQUEST['lname'];
$state = $_REQUEST['state'];
$city = $_REQUEST['city'];
$zip = $_REQUEST['zip'];
$userid = $_REQUEST['shipping_multiple'];
echo $fname;
echo $lname;
echo $state;
echo $city;
echo $zip;
echo $userid;

$query= 'INSERT INTO shipping_multiple (fname, lname, state, city, zip, userid) VALUES ("'.$fname.'","'.$lname.'","'.$state.'","'.$city.'","'.$zip.'","'.$userid.'")';
mysql_query($query) or die('Failed Insertion For New User');

It Echo's Back the Forms Variables perfectly but fails on insertion


#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 04 May 2006 - 08:36 PM

echo the query and then copy/paste it directly into phpmyadmin see if it inserts the row without issues.

also, changing this:

...or die('Failed Insertion For New User');

to this:

... or die(mysql_error());

will give you better help for what's wrong.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 cefalufr

cefalufr
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 04 May 2006 - 08:41 PM

[!--quoteo(post=371367:date=May 4 2006, 04:36 PM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 4 2006, 04:36 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
echo the query and then copy/paste it directly into phpmyadmin see if it inserts the row without issues.

also, changing this:

...or die('Failed Insertion For New User');

to this:

... or die(mysql_error());

will give you better help for what's wrong.
[/quote]
Thks. Never thought of checking. Wrong column name for userid!

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 04 May 2006 - 08:44 PM

ah. yeh that happens :)
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users