使用PHP mysql减去表中的值(金额)? [英] Subtract the value(amount) in table using PHP mysql ?

查看:223
本文介绍了使用PHP mysql减去表中的值(金额)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在mysql中有一个名为customer的表。它有id,名称,号码,密码和平衡各自的数据。我有一个Android应用程序,它连接到这个数据库,并使用数字和密码登录。如果匹配则询问金额以从特定客户余额中检测。数量和密码已成功验证但我需要从客户余额中检测到一些金额。如果这样做..下面的代码用于验证数量和密码

。请让我知道..提前感谢:)



我尝试过:



verify.php

<?php

$ con = mysqli_connect(localhtost,root,,data);

$ number = $ _POST [number];

$ password = $ _POST [password];

$ statement = mysqli_prepare($ con,SELECT * FROM customer WHERE number =?AND password =?);

mysqli_stmt_bind_param($ statement,ss,$ number,$ password);

mysqli_stmt_execute($ statement);

mysqli_stmt_store_result($ statement);

mysqli_stmt_bind_result($ statement,$ id,$ name,$ number,$ password,$ balance);



$ response = array();

$ response [success] = false;



while(mysqli_stmt_fetch($ statement)){

$ response [success] = true;

$ response [id] = $ id;

$ response [name] = $ name;

$ response [number] = $ number;

$ response [password] = $ password;

$ response [balance] = $ balance;

}

echo json_encode($ response);

?>

I have a table in mysql , called customer. it has id,name,number,password & balance with respective data's. i have an Android application which is connect with this database and login with number and password . If it is match then ask amount to detect from particular customer balance.the number and password is successfully verified but i need to detect some the amount from customer balance.how to do that.. below code is for verify the number and password

if my question is not clear. please let me know .. thanks in advance :)

What I have tried:

verify.php
<?php
$con = mysqli_connect("localhtost", "root","", "data");
$number = $_POST["number"];
$password = $_POST["password"];
$statement = mysqli_prepare($con, "SELECT * FROM customer WHERE number = ? AND password = ?");
mysqli_stmt_bind_param($statement, "ss", $number, $password);
mysqli_stmt_execute($statement);
mysqli_stmt_store_result($statement);
mysqli_stmt_bind_result($statement,$id,$name,$number,$password,$balance);

$response = array();
$response["success"] = false;

while(mysqli_stmt_fetch($statement)){
$response["success"] = true;
$response["id"] = $id;
$response["name"] = $name;
$response["number"] = $number;
$response["password"] = $password;
$response["balance"] = $balance;
}
echo json_encode($response);
?>

推荐答案

con = mysqli_connect(localhtost,root,,data);
con = mysqli_connect("localhtost", "root","", "data");


number =


_POST [number];
_POST["number"];


这篇关于使用PHP mysql减去表中的值(金额)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆