Problem Code UPDATE MYSQL PHP

Asked

Viewed 139 times

0

Someone could confirm me if the code below is correct, I’m not good in php or mysql, I just do arrangements and I’m not getting the expected result, the connection with db is correct, no errors(exite um if for error)...

The expected result is when fill in the html "name" is inserted 100000 into the Columa paymoney WHERE name=name

full code http://pastebin.com/Y65ThtnK

<?php
ob_start();
session_start();

include_once 'dbcon.php';

if(isset($_POST['btn-signup'])) {

 $name = trim($_POST['name']);



 $name = strip_tags($name);



 // paymoney encrypt using SHA256();


 // check usuario dup
 $query = "UPDATE player SET paymoney='10000'
           WHERE name ='$name'";


}
?>
  • You could give more details and mention what type this value is 100000 because if it is of type int you do not need to use single quotes and the name variable try to pass so '". $name."'.

  • Only need to execute the query in the bank.

2 answers

2

To be executed.

$query = "UPDATE player SET paymoney='10000'
           WHERE name ='$name'";
$suaconexao -> query($query);

0

Put sql like this:

$query = "UPDATE player SET paymoney='10000'
           WHERE name = ".$name;

Browser other questions tagged

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