-1
私は、 '' caffe ''という名前のmysqlテーブルに格納されている数量-1を減算するPHPコードを実行しようとしています。 テーブルは10で始まり、phpが値caffeで実行されると、テーブルの数量が更新されます。 コードのいくつかの行がうまくいくので、どのように動作するのか理解できます。 URLからPHPはmysqlテーブルから量を引く
- 読み出し値:データベーステーブルから
http://mypage/getdata.php?value=caffe
- 読み出し値
caffe
- 減算-1テーブル
- 更新MySQLのテーブルの値から
caffe
<?
$servername = "localhost";
$username = "xxx";
$password = "";
$database = "my_ufficina";
//creating a new connection object using mysqli
$conn = new mysqli($servername, $username, $password, $database);
//if there is some error connecting to the database
//with die we will stop the further execution by displaying a message causing the error
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//if everything is fine
$txt = $_GET['value'];
if ($txt == caffe)
$count = 1;
echo $count;
....また、リンクが –
@DipanwitaKunduザ・作業されていません。
ところで、あなたはそれを使用する前に、$ _GETから値をサニタイズする必要があります。そのようethingリンクは動作するためのものではなく、ダミーです。 – mega6382
OKですが、あなたの要件を更新してください、それは明確ではありません –