1

I have a multi-step form which I am trying to fix but I am getting the error:

Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /home/xxxx/public_html/wp-content/themes/xxxx/template-submit-property.php on line 315

Warning: mysql_query(): A link to the server could not be established in /home/xxxx/public_html/wp-content/themes/xxxx/template-submit-property.php on line 315

There was an error connecting to the database: Access denied for user 'root'@'localhost' (using password: NO)

So I've checked the wp-config file and the details there are correct.

I looked through this

https://wordpress.org/support/topic/access-denied-for-user-localhost-using-password-no

And this

https://stackoverflow.com/questions/10873803/mysql-error-access-denied-for-user-using-password-no

And so it seems like the problem is to do with how the db is being accessed. However everything else seems to work fine, the other parts of the form are able to access the db and pull data from it (such as field names etc).

So I've reverted to using good old print_r and this is the point where everything seems to break down:

$property_id = wp_insert_post( $new_property ); // Insert Property and get Property ID

echo "<pre>";
print_r($property_id);
exit;

So I think it must be something to do with wp_insert_post...? By the way $new_property variable = 'pending'.

Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.