• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP MySQLi INSERT不插入数据(PHP MySQLi INSERT not inserting data)_电脑培训 ...

原作者: [db:作者] 来自: 网络 收藏 邀请

PHP MySQLi INSERT不插入数据(PHP MySQLi INSERT not inserting data)

我正在尝试将mysqli插入到数据库表中,连接正常,$ _GET ['emailaddress']已填充,表存在,它只是没有插入数据。

$connection = mysqli_connect("localhost","database","password");

mysqli_select_db($connection, "database");

if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
        die;
}else{
        echo 'success';
}

mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "'");

mysqli_close($connection);

I am trying to do an mysqli insert into a database table, the connection is working, the $_GET['emailaddress'] is populated, the table exist, its just no data is being inserted.

$connection = mysqli_connect("localhost","database","password");

mysqli_select_db($connection, "database");

if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
        die;
}else{
        echo 'success';
}

mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "'");

mysqli_close($connection);

原文:https://stackoverflow.com/questions/29147127
更新时间:2022-03-22 19:03

最满意答案

你缺少1个括号

mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "')");

You're missing 1 parenthesis

mysqli_query($connection, "INSERT INTO `campaign` (`email`) VALUES ('" . $_GET['emailaddress'] . "')");

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap