MySQL 插入子句问题

发布于 2024-08-30 06:25:29 字数 844 浏览 2 评论 0原文

我在这个问题上花了几个小时,我一生都无法弄清楚,我有一个未执行的插入 MYSQL 命令,我尝试在 phpMyadmin 上手动运行查询,它实际上确实有效,但对于由于某种原因,当站点运行命令时,数据库中没有输入任何内容。 重要的是

$sql = "INSERT INTO beforeActivation (about, 
  firstname, lastname, businessname, typeofpractice, 
  practicespecial, gender, address, city, zip, cellphone, 
  businessphone, email, username, password, date) 
VALUES('$about', 
  '$firstname', '$lastname', '$businessname', '$typeofpractice', 
  '$practicespecial', '$gender', '$address', '$city', '$zip', '$cellphone', 
  '$businessphone', '$email', '$username', '$password', CURDATE())";

mysql_query($sql) or die(mysql_error());
$_SESSION["idForBeforeAct"] = mysql_insert_id();

,脚本继续运行它不会“死亡”或吐出任何类型的错误,它只是宣布信息已输入并继续到下一个表单。我在 phpmyadmin 上运行了完全相同的查询,它用 $cellphone 等变量名称填充了表,因为它们没有分配给任何东西(显然)。但要点是插入命令正在工作,没有语法错误,如果有人有任何建议,那将是一个巨大的帮助,谢谢!

I've spent hours on this problem and for the life of me I can't figure it out, I have an Insert MYSQL command that is not executing, I've tried manually running the query on phpMyadmin and it actually does work but for some reason when the site runs the command, nothing is entered into the database. I have

$sql = "INSERT INTO beforeActivation (about, 
  firstname, lastname, businessname, typeofpractice, 
  practicespecial, gender, address, city, zip, cellphone, 
  businessphone, email, username, password, date) 
VALUES('$about', 
  '$firstname', '$lastname', '$businessname', '$typeofpractice', 
  '$practicespecial', '$gender', '$address', '$city', '$zip', '$cellphone', 
  '$businessphone', '$email', '$username', '$password', CURDATE())";

mysql_query($sql) or die(mysql_error());
$_SESSION["idForBeforeAct"] = mysql_insert_id();

Importantly, the script continues to run it does not 'die' or spit out any type of error it merely announces that the info was entered and continues to the next form. I ran the exact same query on phpmyadmin and it filled the table up with the variable names like $cellphone because they aren't assigned to anything (obviously). But the main point is the insert command is working, no syntax error, if anyone has any advice it would be a huge help thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

撑一把青伞 2024-09-06 06:25:29

如果您的表是 InnoDB,请检查您是否已打开自动提交。

Check that you have autocommit turned on if your table is InnoDB.

很糊涂小朋友 2024-09-06 06:25:29

我发现我的错误,该命令有效,有一个杂散的 opendb() 函数指向 .com 切换之前的数据库,抱歉,感谢大家的努力

i found my mistake, the command works, there was a stray opendb() function which pointed to the db prior to .com switch, sorry guys thanks for all your efforts

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文