Jump to content


Photo

Help with a simple code


  • Please log in to reply
4 replies to this topic

#1 ulenie

ulenie
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 July 2006 - 01:39 AM

The current code is
$sql = 'INSERT INTO stats (subid,ref) VALUES (\''.$_POST['email'].'\',\''.$_REQUEST['ref'].'\')';

What i want to do is insert a "name" and "paid" column.  And I want to set name to 'Registration Bonus' and paid to '1.00'.  The table and everything is already created.  Someone help me please!

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 21 July 2006 - 01:54 AM

first of all, I suggested you should revise the query for viewing friendly.  After all, you're human.
So what u wanted is along with inserting subid, ref, you'd like to insert name and paid with it.

here is the code:
$sql = "insert into stats (subid,ref,name,paid) values
    ('{$_POST['email']}',
    '{$_REQUEST['ref']}',
    'Registration Bonus',
    '1.00')";

Life's too short for arguing.

#3 ulenie

ulenie
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 July 2006 - 02:17 AM

first of all, I suggested you should revise the query for viewing friendly.  After all, you're human.
So what u wanted is along with inserting subid, ref, you'd like to insert name and paid with it.

here is the code:

$sql = "insert into stats (subid,ref,name,paid) values
    ('{$_POST['email']}',
    '{$_REQUEST['ref']}',
    'Registration Bonus',
    '1.00')";


Sorry, I didn't write the code.  When I looked at it, i thought the same thing.  That's why i couldnt figure it out.  I tried to do similar to what you wrote but it gave me an error.  Let me try exatly what you wrote.  Thanks.

#4 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 21 July 2006 - 02:22 AM

If you received error, post the whole error message.
Life's too short for arguing.

#5 ulenie

ulenie
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 21 July 2006 - 02:33 AM

If you received error, post the whole error message.


It worked perfectly and was very easy to understand.  Thanks much.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users