Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$8
Delete SQL entry from WP DB with ajax
If I disable jquery, everything works fine, but with jquery, the SQL query isn't getting processed correctly (or at all?).
I've put all of the necessary code (from multiple files) onto pastebin:
http://pastebin.com/rrLseAbs
Please read the comments carefully as I've explained everything there.
My speculation is not the information getting sent to the query is incorrect, so if anyone has an idea for how to display (with JS) the information that ajax is sending, that'd be a huge help.
This question has been answered.
Pippin Williamson | 12/02/10 at 10:43pm
Edit
(2) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
12/02/10
11:10pmDenzel Chia says:Hi,
Is there a possibility that $baseDir is wrong? or probably missing backslash. Causing AJAX sending data to wrong url?
Thanks.- 12/02/10 10:59pm
Pippin Williamson says:When viewing the source, the URL to process-data.php is correct
- 12/02/10 10:59pm
Denzel Chia says:Another possibility, is you probably forgot to global $wpdb, before your sql query in process-data.php?
Thanks. - 12/02/10 11:08pm
Pippin Williamson says:Ah! Though that doesn't immediately fix it, you saying that did make me realize that I was using an include function on process-data.php in the main plugin file, so globals were detected fine, but with an ajax request, those globals probably arn't loaded.
I'll let you know in a few. - 12/02/10 11:09pm
Pippin Williamson says:Excellent! That's done it!
- 12/02/10 10:59pm
-

Last edited:
12/02/10
11:09pmLarrie Bernd Rocha says:You can only use $wpdb when your PHP file is within the plugin or theme.
You need to declare these lines on top of your process-data.php.
define('WP_USE_THEMES', false);
require('../../wp-blog-header.php');
I assume that process-data.php is at [root]/includes/process-data.php.
Make sure that you have set the path for wp-blog-header.php correctly.
Also, make sure that $baseDir is correct.
Tests needed:
1. test your process-data.php if deletion works. Try a passing a sample ID.
2. test if clicking the button invokes
If these two works then you are good.
This question has expired.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
