简体   繁体   English

PHP中的MySQL查询不再有效

[英]MySQL query in PHP no longer works

I took over maintenance of this website, and I only know basic commands of MySQL . 我接管了这个网站的维护,我只知道MySQL的基本命令。 When WordPress updated to version 4.3.1 this query stopped working. 当WordPress更新到版本4.3.1时,此查询停止工作。 It worked fine for months up until then. 直到那时,它工作好几个月。

The user inputs information into a form which is passed into the MySQL database , this still works. 用户将信息输入到传递到MySQL数据库的表单中,这仍然有效。 Then data is extracted from the form that was filled out, and emailed to the company. 然后从填写的表单中提取数据,并通过电子邮件发送给公司。 The email goes through but the fields are empty. 电子邮件通过但字段为空。

'$query = "INSERT INTO ..._app (appid,$insert_keys) VALUES ('',$insert_values)";

mysql_query($query)
            or die(mysql_error());

$app_query = mysql_query("SELECT MAX(appid) AS appid FROM ..._app")
    or die(mysql_error());
$app_row = mysql_fetch_array($app_query);
extract($app_row);
$agent_msg = "...
    \n
    Application ID: $appid\n
    Borrower Information\n
    First Name: $fname\r
    Middle: $mname\r
    Last Name: $lname\r

...etc. ...等等。 Yes, I know this is MySQL which is deprecated, but the client is not willing to have everything rewritten at this time. 是的,我知道这是不推荐使用的MySQL,但是客户端不愿意在此时重写所有内容。 It seems too coincidental that this stopped working when WordPress was updated. 当WordPress更新时,这似乎停止了工作似乎太巧合了。 I'm not sure if it's fixable in the MySQL code . 我不确定它是否可以在MySQL code修复。

you should check all your form field name and debug with print_r($_REQUEST) and see, it will return all the field or not. 您应该检查所有表单字段名称并使用print_r($ _ REQUEST)调试并查看,它将返回所有字段或不返回。 If yes, than you can also try below WP function: 如果是,您还可以尝试以下WP功能:

global $wpdb;
$wpdb->insert( 'table name', array( 'field 1' => $_REQUEST['field 1'], 'field 2' => $_REQUEST['field 2']));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM