Update table after payment completed PHP

Asked

Viewed 92 times

0

Good I’m trying to automate the release of products in my store so I made a purchase status system only that does not update the line that was paid or create a new line

Behold: http://prntscr.com/febasn

I just don’t know how to update a specific line...

Code that picks up the data: https://hastebin.com/fadiyecune.xml

[TRY] Code that updates SQL:

Warning: I’m a beginner in PHP so I got a little lost...

$status = $_GET["status"];

$usernick = $_SESSION['user'];

$query = "SELECT * FROM purchases WHERE item_token='". $_SESSION['token']." '"; // WHERE = "Condition -> 'if,where' """ $result= @mysql_query("$query"); // starts the query while ($Row = @mysql_fetch_array($result)) { //while re-organizes all components of this table, such as ID, NAME, EMAIL and other ARGUMENTS, where ROW = rows $get_id = stripslashes($Row['id']); // In this case, set the NAME row to the item name and pegeui its value.

$query26 = "UPDATE registration SET status='$status' WHERE id='$get_id'"; //Sets a variable to insert the DATA into the table. NOTE: no need to put the ID, because you defined as AI(Auto Increment) mysql_query($query26); //Inserts values defined in $query26

}

  • Your query is wrong, isn’t it? Use UPDATE compras SET status='$staus', item_nome='$item_nome' where "Seu where"

  • Unfortunately it didn’t work

  • What error has appeared?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.