Hack Forums
[PHP] postback help , mysqli functions! - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] postback help , mysqli functions! (/showthread.php?tid=5770691)



postback help , mysqli functions! - JAS - Dec 18, 2017

Hello everyone,

Im stuck on this final part!

I retrieve the following variables from my postback fine:

$id = $_GET["id"]; 
$old = $_GET["old"]; 
$amount = $_GET["amount"]; 
$currency_name = $_GET["currency_name"];
$user_id = $_GET["user_id"];
$payout = $_GET["payout"]; 
$o_name = $_GET["o_name"]; 
$sig = $_GET["sig"]; 


Im connected to my database fine.

But inserting the infomation is where im stuck...

I want to instert the amount into a row called 'robux' where the row 'username' equals user_id ! Please help! :O


RE: postback help , mysqli functions! - undeRq - Dec 18, 2017

What do you mean username equals user_id? Are they in the same table?


RE: postback help , mysqli functions! - Charger - Dec 18, 2017

http://php.net/manual/en/pdo.prepared-statements.php


First result on google.


RE: postback help , mysqli functions! - JAS - Dec 18, 2017

(Dec 18, 2017 01:03 PM)undeRq Wrote:  What do you mean username equals user_id? Are they in the same table?

Yes here is the table:
[Image: cvw40O.png]

Thanks for help


(Dec 18, 2017 01:11 PM)Charger Wrote:  http://php.net/manual/en/pdo.prepared-statements.php


First result on google.

I really need help though because im not familiar with sql


That table is called users by the way.


RE: postback help , mysqli functions! - undeRq - Dec 18, 2017

Do you have skype? I can help you on skype if you want.


RE: postback help , mysqli functions! - JAS - Dec 18, 2017

(Dec 18, 2017 01:51 PM)undeRq Wrote:  Do you have skype? I can help you on skype if you want.

No sorry, please dont be afraid to help here though.


RE: postback help , mysqli functions! - Charger - Dec 18, 2017

(Dec 18, 2017 01:12 PM)free707 Wrote:  Yes here is the table:
[Image: cvw40O.png]

Thanks for help



I really need help though because im not familiar with sql


That table is called users by the way.

Dude, it says it as soon as you scroll...

PHP Code

<?php
$stmt 
= $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);

// insert one row
$name = 'one';
$value = 1;
$stmt->execute();

// insert another row with different values
$name = 'two';
$value = 2;
$stmt->execute();
?>



RE: postback help , mysqli functions! - undeRq - Dec 18, 2017

(Dec 18, 2017 02:19 PM)Charger Wrote:  Dude, it says it as soon as you scroll...

PHP Code

<?php
$stmt 
= $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);

// insert one row
$name = 'one';
$value = 1;
$stmt->execute();

// insert another row with different values
$name = 'two';
$value = 2;
$stmt->execute();
?>
He is using MySQLi not PDO, and my recommendation is to switch to PDO driver.

Can you post me here how did you execute the "insert" script?


Example,

You have username, email, refferal, password, rank, robux, secondammount and date.

ID must be AI(Auto Increment), so don't insert anything there. If your ID isn't auto increment, you have an option in PHPMyAdmin when you edit row called AI.

Second, do like this $query = mysqli_query($conn, "INSERT Into {tablename} (username, email, refferal, password, rank, robux, secondammount, date.) VALUES ({$username},{$email},{$refferal},{$password},{$rank},{$robux},{$secondammount},{$date})");

then, if it's not working, just paste me output of $query like this print_r($query);


RE: postback help , mysqli functions! - JAS - Dec 19, 2017

(Dec 18, 2017 02:19 PM)Charger Wrote:  Dude, it says it as soon as you scroll...

PHP Code

<?php
$stmt 
= $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);

// insert one row
$name = 'one';
$value = 1;
$stmt->execute();

// insert another row with different values
$name = 'two';
$value = 2;
$stmt->execute();
?>

Thanks but im still struggling, Here is my entire page. Hope you can see the error:
Code
https://pastebin.com/raw/9s9Cb1gR


Still need help with this.