MySQL query in PHP no longer works

I took over maintenance of this website, and I only know basic commands of MySQL. When WordPress updated to version 4.3.1 this query stopped working. 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. 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.

Read More

'$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: $appidn
    Borrower Informationn
    First Name: $fnamer
    Middle: $mnamer
    Last Name: $lnamer

…etc. Yes, I know this is MySQL which is deprecated, but the client is not willing to have everything rewritten at this time. It seems too coincidental that this stopped working when WordPress was updated. I’m not sure if it’s fixable in the MySQL code.

Related posts

1 comment

  1. you should check all your form field name and debug with print_r($_REQUEST) and see, it will return all the field or not. If yes, than you can also try below WP function:

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

Comments are closed.