Jump to content

gitn32

Members
  • Posts

    26
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

gitn32's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. And you are logged in as a user. So I guess the problem is my query: mysql_query("UPDATE users SET accbal = '$newaccbal' WHERE id = $_POST['id'] AND username = '$user'"); This is what I have, and I'm using the hidden input, but it comes up with a error.
  2. I have the if isset post submit. But I don't understand the part about transferring the id to update the amount. I'm am fairly new to this, and am just looking for some help.
  3. If fixed this on my real code. Let me re-explain the problem. I have 2 pieces of data. They are both displayed on the webpage. They each have the own account balance. For example, 1 can be 500, and the other can be 750. Lets say 500 is on the top of the page. I click the remove button, and 750 (which is on the bottom of the page) is subtracted from the account balance. I would like to make it where, when I click the top amount (500), that 500 is subtracted from the account balance, instead of 750. Your guys are telling me what's wrong with my HTML, which I have fixed. I appreciate that, but it's not the question. Please trty and help with the one above, if you can't help then that's fine. I appreciate your guys' time.
  4. Yes that was helpful. But not to this question: I have multiple pieces of data. Each piece of data has its own submit button when displayed. If there is 2 pieces of data and I hit the top button, the bottom data is the accbalance. I want to make it so that if I hit the top button the top button the newaccbal is the amount of the top.
  5. Thanks, but that wasn't the question......
  6. Ok the first problem is solved, how about this: $result = mysql_query ("SELECT * FROM invoices WHERE username='$user'"); while($row = mysql_fetch_array($result)) { $username = $row['username']; $bill = $row['invoice']; $ammount = $row['ammount']; $id = $row['id']; echo " <font size='3' face='arial'> <table width='250' border='0' cellspacing='1' cellpadding='0'> <tr> <td><b>$id, $bill: $$ammount</b></td> </tr> <tr> <td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td> </tr> </table> </font> "; if(isset($_POST['submit'])) { $got_error = 0; if ($accbal > $ammount){ $naccbal = $accbal - $ammount; require ("userconnect.php"); mysql_query("UPDATE users SET accbal = '$naccbal' WHERE username = '$user'"); } else { $got_error = 1; echo "Not enough money in account."; } } //$accbal IS defined before code starts //And there is an extra $ before $ammount so it displays a dollar sign, and the ammount. I'm also having the same problem with this, and this is different because your updating not deleting. This is a virtual funding system.
  7. Thank you! If you have time can you show me what the edited one is. Once I add the hidden input I would like to check that it is correct.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.