如何在PHP中按钮单击时从mysql数据库中获取和更改值? [英] How do I get and change a value from a mysql database on button click in PHP?
问题描述
我想要的只是简单:2个按钮,1个按钮可以获得某个值在mySQL上的点击,第2个按钮从值中扣除并保存在mySQL数据库中/更新它。
在一个例子中
mySQL数据库:
ID 1名称Textil INT 20
我的php页面:2个按钮:
-获得价值
- 更改并更新它
i点击获取价值,它获得20 textil,然后我点击更改并更新它:它将它更改为我已经在脚本中预先确定的新值并更新数据库。
怎么做我这样做了吗?
我尝试了什么:
我喜欢许多教程,但它们都是形式,如
名称
姓氏
年龄
并点击按钮更新年龄,我不想要任何这样的输入,我只是想知道如何在按钮点击时将值更改为已经预先确定的值。
你的问题基本上是为我这样做。
这是错误的网站。
学习SQL
学习PHP
学习JavaScript
这是怎么做的 - W3Schools在线网络教程 [ ^ ]
All I want is simple: 2 buttons, 1 button gets you a certain value that is in mySQL on click, 2nd button deducts from the value and saves it in mySQL database/updates it.
In an example
mySQL database:
ID 1 Name Textil INT 20
my php page: 2 buttons:
-Get Value
-Change it and Update it
i click Get Value, it gets 20 from textil, then i click change it and update it: and it changes it to a new value i already pre-determined in the script and updates the database.
How do i do this?
What I have tried:
I fond many tutorials but they are all forms like
Name
Surname
Age
and on button click you update the age, and i dont want any input like that, i just want to know how to change a value to an already pre-determined value on button click.
You're Question is basically "Do this For Me".
This is the wrong website for that.
Learn SQL
Learn PHP
Learn JavaScript
That's how it's done - W3Schools Online Web Tutorials[^]
这篇关于如何在PHP中按钮单击时从mysql数据库中获取和更改值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!