dongzen2675 2014-08-12 19:39
浏览 56

MySQL / PHP两次插入同一行

Please help. I consider myself to have a reasonable understanding of MySql & PHP, but for the life of me I can't figure out why this code is inserting the same row twice. I've literally stripped it back to the following code:

<?php

$query = "INSERT INTO `cs_social_alerts` (email) VALUES ('test@test.com')";
mysql_query($query);

?>

The MySQL table it's being inserted into has 10 columns in it, but even with all of them mentioned in the query, it still inserts 'test@test.com' on two rows, with separate primary keys.

I've created a new Wordpress page to run this on as all other pages seem to be functioning fine without the duplication.

I've done some Googling which hasn't found much of any help - Is there anyway I can check where the second query is coming from? I've starred at the above code for about an hour now and cannot see any issues with it.

Any ideas/help MUCH appreciated!

Thanks

----- EDIT -----

So here's the result from the debug traceback, the code that's being run is literally the 2 lines above - I've blanked the domain for security. Can anyone see any interference? I'm no PHP expert and with all the extra Wordpress stuff thrown in, I'm not sure what's what! Thanks guys

0 eval() called at [/var/sites/c/****.com/public_html/wp-content/plugins/wp-exec-php/wp-exec-php.php:652]

1 WP_exec_PHP->exec(

$myQuery = "INSERT INTO cs_social_alerts (email) VALUES ('test@test.com')";

mysql_query($myQuery);

debug_print_backtrace()

?>

) called at [/var/sites/c/****.com/public_html/wp-content/plugins/wp-exec-php/wp-exec-php.php:692]

2 WP_exec_PHP->_exec_post(

$myQuery = "INSERT INTO cs_social_alerts (email) VALUES ('test@test.com')";

mysql_query($myQuery);

debug_print_backtrace()

?>

)

3 call_user_func_array(Array ([0] => WP_exec_PHP Object ([] => Array (),[] => /var/sites/c/*.com/public_html/wp-content/plugins/wp-exec-php/wp-exec-php.php),[1] => _exec_post), Array ([0] =>

$myQuery = "INSERT INTO cs_social_alerts (email) VALUES ('test@test.com')";

mysql_query($myQuery);

debug_print_backtrace()

?>

)) called at [/var/sites/c/*.com/public_html/wp-includes/plugin.php:192]

4 apply_filters(the_content,

$myQuery = "INSERT INTO cs_social_alerts (email) VALUES ('test@test.com')";

mysql_query($myQuery);

debug_print_backtrace()

?>

  • 写回答

4条回答 默认 最新

  • douzhan1031 2014-08-12 19:42
    关注

    Use the PHP function debug_print_backtrace() to find out where your code is being called from.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100