dqkf49487 2014-08-08 14:35
浏览 18
已采纳

PHP插入错误没有解释

im farely new to php coding. I have been using web pages to assist me in learning. But right now im stuck.

Im trying to insert a record into a table but im unable. the php just produces the message "error:" but gives no further info. any assistance would be great.

P.S the conenction to the table is working fine, already checked i am able to read data, and obviously the username and password are for read and write rights...

  $sql="INSERT INTO users (email, username, password, full_name, company_name, active, active_until, start_date, remote_backup, local_backup)
VALUES
('".$register_email_address."','".$register_username."','".$register_password."','".$register_fullname."','".$register_company_name."','".$active."','".$active_until."','".$start_date."','".$remote_backup."','".$local_backup."'";
if (!mysqli_query($sql,$con))
  {
  die('Error: ' . mysqli_error());
  }
echo "1 record added";
  • 写回答

3条回答 默认 最新

  • douerqu2319 2014-08-08 14:39
    关注
    if (!mysqli_query($sql,$con))
    

    The mysqli_query function takes the connection as the first argument, not the second. You'll need to switch the order of the arguments. You should also modify your php.ini file to enable error reporting + display errors - it'll tell you about this sort of thing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟