gpt4 book ai didi

php - 我在服务器上的文件并在本地系统中插入数据

转载 作者:行者123 更新时间:2023-11-29 23:02:27 26 4
gpt4 key购买 nike

我在服务器上的文件,例如 http://www.example.com/insert.php

我在insert.php中的代码

<?php
$conn=mysql_connect("127.0.0.1","root","") or die("Unable to Connect");
mysql_select_db("test") or die("Could not open the db");

mysql_query("INSERT INTO `test`.`user` (`uno`, `uname`) VALUES ('2', 'acv');");
?>

当我输入打开的 URL 时,我想安装本地主机数据库。我该如何插入?

在 PHP 中意味着我在服务器上的 php 文件,我想在本地系统中插入数据?

最佳答案

试试这个。更改主机名。

<?php
mysql_connect("localhost","root","root") or die("Unable to Connect");
mysql_select_db("test") or die("Could not open the db");

mysql_query("INSERT INTO `test`.`user` (`uno`, `uname`) VALUES (2 , 'acv');");
?>

关于php - 我在服务器上的文件并在本地系统中插入数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28426719/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com