Having read around, this is all due to the same reason, using a deprecated query in the plugin, namely the mysql_query().
I’ll get this working using PDO on the next release, but for now I’ve been assured by a WP guru that this is nothing to worry about in the short / medium term.
Thanks for letting me know! Is your query monitor a plugin? Can you send me the URL so I can see. Getting no errors using my standard wp_debug stuff.
Alex
Thread Starter
KTS915
(@kts915)
Thanks, Alex.
Yes, Query Monitor is a plugin. See here. I have heard from other developers that it gives them far more information than the standard wp_debug stuff.
Thread Starter
KTS915
(@kts915)
I don’t know if this also has the same cause, but the import function isn’t working to import quizzes. The process seesm to work fine, and reports success, but no imported questions or quizzes actually appear in the back-end.
Just to be sure, I have checked the .csv file, and it definitely has questions there!
Will check tonight! Thanks for letting me know.
Alex
Thread Starter
KTS915
(@kts915)
Email sent, with .csv attachment. Thanks for having a look at this!
Hi,
OK I’ve looked into this and am not having much luck – BUT I have found out you can remove the mysql_query line on line 13, quiz-tool-lite.php
So take this out and all should work as normal, without the PHP warnings.
I’ll keep trying to find an answer to your import questions – I need to reproduce it. I suspect its because you don’t have the right DB tables / columns but don’t know why. Will get back to you soon
Alex
Thread Starter
KTS915
(@kts915)
Thanks for looking into this, Alex.
I have now commented out that line, and the warnings have indeed disappeared. Unfortunately, as you obviously expected, the import function still won’t work. I even tried exporting a question and then re-importing it but, although I get a success message, it does not re-import.
I am wondering if the reason might be a different version of PHP. This is all on my localhost development installlation, and I recently upgraded my system so that it is now running PHP 5.5 instead of 5.3. Could that be it?
I’ll check what version we have here.
All the insert / update stuff is done using the recommended WP queries so the version shouldn’t matter though.
I will write a plugin that confirms the table column names so we can compare. Is your local install multisite?
Alex
Thread Starter
KTS915
(@kts915)
No, my installation is not multisite.
I have just discovered how to access the server logs, and I have found the following:
WordPress database error Multiple primary key defined for query ALTER TABLE wp_AI_Quiz_tblResponseOptions ADD PRIMARY KEY (optionID) made by activate_plugin, do_action('activate_quiz-tool-lite/quiz-tool-lite.php'), call_user_func_array, AI_Quiz_db_create, AI_Quiz_create_tables, dbDelta
Another thing I have just found is that another plugin tells me that the curl timeout is set to 60 seconds, when it recommends 300. I must admit I don’t know how to change that, nor whether it would make any difference here. (I’m using Linux Mint 17, based on Ubuntu 14.04).
Thanks very much!
That was REALLY useful thank you. That query monitor tool is invaluable.
OK I reproduced the error and believe I have fixed the errors you are seeing.
If you’re interested (probably not) it was REALLY annoyingly simple.
In /scripts/database.php at the end of each ‘create table’ query it sets the primary key.
I had ONE space between the PRIMARY KEY and the column name, when I actually needed two.
I’ll update the plugin online today so you can get the latest file – just that one is needed.
I don’t know if that will fix your import problems – I can’t reproduce that problem yet. Lets hope this fix works for you. Please let me know.
Alex
Thread Starter
KTS915
(@kts915)
Glad the log was helpful. Although that meant nothing to me, I’m always interested to hear what the problem was!
Thanks for the latest version. I now get no errors immediately upon installing it or when accessing posts and pages.
However, it hasn’t fixed the import quiz problem, although it still says that the questions have been added. At the same time, Query Monitor reports this:
Warning
mysql_real_escape_string(): Access denied for user 'www-data'@'localhost' (using password: NO)
wp-content/plugins/quiz-tool-lite/scripts/export-functions.php:121
mysql_real_escape_string()
AI_Quiz_importExport::checkCSVUpload()
drawAIquiz_export()
do_action('quiz-questions_page_ai-quiz-export') Plugin: quiz-tool-lite
Warning
mysql_real_escape_string(): A link to the server could not be established
wp-content/plugins/quiz-tool-lite/scripts/export-functions.php:121 mysql_real_escape_string()
AI_Quiz_importExport::checkCSVUpload()
drawAIquiz_export()
do_action('quiz-questions_page_ai-quiz-export') Plugin: quiz-tool-lite
Notice
Undefined index: username
wp-content/plugins/quiz-tool-lite/scripts/export-functions.php:107 AI_Quiz_importExport::checkCSVUpload()
drawAIquiz_export()
do_action('quiz-questions_page_ai-quiz-export') Plugin: quiz-tool-lite
Strict
Non-static method AI_Quiz_importExport::checkCSVUpload() should not be called statically
wp-content/plugins/quiz-tool-lite/admin/export.php:13 AI_Quiz_importExport::checkCSVUpload()
drawAIquiz_export()
do_action('quiz-questions_page_ai-quiz-export') Plugin: quiz-tool-lite
Strict
Non-static method utils::getFileExtension() should not be called statically
wp-content/plugins/quiz-tool-lite/scripts/export-functions.php:98 utils::getFileExtension()
AI_Quiz_importExport::checkCSVUpload()
drawAIquiz_export()
do_action('quiz-questions_page_ai-quiz-export') Plugin: quiz-tool-lite
Deprecated
mysql_real_escape_string(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead
wp-content/plugins/quiz-tool-lite/scripts/export-functions.php:121
Thread Starter
KTS915
(@kts915)
Just to update you, I have now managed to import the .csv file!
It turned out that this, latest version of Linux Mint (and, presumably, Ubuntu) has extra security precautions in place. I need to use phpmyadmin to add www-data as a user with no priviliges and no password. That sounds a bit batty to me, but I’m sure it makes sense to a developer!
Anyway, now Query Monitor is reporting something different:
Non-static method utils::convertTextFromDB() should not be called statically
wp-content/plugins/quiz-tool-lite/admin/questions.php:10
utils::convertTextFromDB()
drawAIquiz_questionList()
do_action('admin_page_ai-quiz-question-list')
Non-static method utils::convertTextFromDB() should not be called statically
wp-content/plugins/quiz-tool-lite/admin/questions.php:29
utils::convertTextFromDB()
drawAIquiz_questionList()
do_action('admin_page_ai-quiz-question-list')
Non-static method utils::convertTextFromDB() should not be called statically
wp-content/plugins/quiz-tool-lite/admin/questions.php:86
utils::convertTextFromDB()
drawAIquiz_questionList()
do_action('admin_page_ai-quiz-question-list')
Non-static method utils::limitWords() should not be called statically wp-content/plugins/quiz-tool-lite/admin/questions.php:88 utils::limitWords()
drawAIquiz_questionList()
do_action('admin_page_ai-quiz-question-list')
Thanks very much for helping me out with all this!!