PHP利用数据库生成API

news/2024/7/16 6:50:36

第一步:首先利用HBuilder建立一个PHP项目:

新建一个php文件,与数据库建立连接:

<?php
   $con=mysql_connect("localhost","root","") or die(mysql_error);
     mysql_select_db("test");//test为表名
?>

再次新建一个php文件,生成API

<?php
$randnumber=$_GET['randnumber'];//参数
$username=$_GET['username'];
require 'mysql_connect.php';
mysql_query("update test set username = '$username' where (randnumber) = ('$randnumber')");
?>

生成结果:

http://127.0.0.1:8080/php/save.php?randnumber=21583424&username=dongge



http://www.niftyadmin.cn/n/3649366.html

相关文章

Xftp和Xshelll的安装—远程连接linux

什么是xftp和xshell呢&#xff0c;来看看百度词条的解释。 Xftp——是一个功能强大的SFTP、FTP 文件传输软件。使用了 Xftp 以后&#xff0c;MS Windows 用户能安全地在 UNIX/Linux 和 Windows PC 之间传输文件。 Xshell——是一个强大的安全终端模拟软件&#xff0c;它…

react-hooks_如何使用React Hooks构建React To-Do应用

react-hooks介绍 (Introduction) React is a front-end JavaScript library that can be used to create interactive user interfaces for your application. In this tutorial, you will create a to-do app that covers all four aspects of a CRUD: Create, Read, Update, …

云服务器和域名的购买—华为云

现今国内主流的云服务器厂家有华为云、阿里云、腾讯云等。老牌的有西部数据。而国内市场几乎被这三家占有。三家公司的云服务器各有优势&#xff0c;总体来说都不错。选择华为云是因为它相对安全和稳定。云服务器和域名都在华为云进行购买。在其他公司购买的流程也大致相同。 …

[EnterpriseServices]利用assembly定义我们的组件在COM+中的注册方式

整理者 郑昀UltraPower 利用以下assembly定义我们的组件在COM中的注册方式&#xff0c;其中&#xff1a;ApplicationName 属性是"COM 目录"和"组件服务管理"控制台中显示的 COM 应用程序的名称。[assembly: ApplicationName("MyDLL.Interface")]…

bat命令行遍历文件_命令行基础知识:如何遍历目录中的文件

bat命令行遍历文件Looping is one of the most powerful things you can do in programming. It allows you to apply the same logic over and over to a group of items with minimal code. If done properly, infinite loops can be a blessing instead of a curse. Unfortu…

ndk的入门

第一个ndk 第一步&#xff1a;MainActivity中定义一个方法: public static native String getStringFromC(); 第二步生成头文件: ①我的项目位置&#xff1a;E:\android\HelloNdk ②我的sdk中android.jar包的位置&#xff1a;G:\android\AndroidX86\AndroidX86\sdk\platfor…

CentOS 7安装并配置Nginx

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件&#xff08;IMAP/POP3&#xff09;代理服务器&#xff0c;在BSD-like 协议下发行。其特点是占有内存少&#xff0c;并发能力强&#xff0c;事实上nginx的并发能力在同类型的网页服务器中表现较好&#xff0c;中国大陆使…

spring react_如何使用React Spring创建动画的React应用

spring react介绍 (Introduction) Animations add life to your applications and improve the overall user experience. React Spring is an animation package that uses spring-like physics in its core animations to make it easily configurable. Springs are cumulati…