gpt4 book ai didi

php - 从 wampserver 中的本地主机打开流时出错

转载 作者:行者123 更新时间:2023-11-29 21:39:43 24 4
gpt4 key购买 nike

我正在使用 wampserver。我已经在数据库中成功连接。但是,我无法在数据库中插入数据。我的文件夹名为 uomwebapplication,其中有 2 个名为 :init 和 register 的 php 文件。我的 init.php 文件运行良好,但我的 register.php 文件运行不正常。帮助我!!!!!!!!!这是我的代码:

init.php

<?php
$db_name="uomwebappdb";
$mysql_user="root";
$mysql_pass="";
$server_name="localhost";

$con=mysqli_connect($server_name,$mysql_user,$mysql_pass,$db_name);
if(!$con)
{
echo"Connection Error...".mysqli_connect_error();
} else {
echo"<h3>Database connection Success...</h3>";
}
?>

注册.php

<?php

require"init";
$name="ak";
$surname="shay";
$password="shayak";

$sql_query="insert into user_information
values('$name','$surname','$password');";

if(mysqli_query($con,$sql_query))
{
echo"<h3> Data Insertion Success...</h3>";
} else {
echo"Data Insertion Error...".mysqli_error($con);
}
?>

错误

1) 警告:require(init): 无法打开流:第 7 行 C:\wamp\www\uomwebapplication\register.php 中没有此类文件或目录

2) fatal error :require(): 无法在第 7 行的 C:\wamp\www\uomwebapplication\register.php 中打开所需的 'init' (include_path='.;C:\php\pear')

最佳答案

register.php 中,您有以下行:

require"init"

这不应该是

require 'init.php';

关于php - 从 wampserver 中的本地主机打开流时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34636691/

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