Quote:
Originally Posted by midnz
Hi Logician, I was wondering if you can solve my puzzle:
I'm using your default web query $WQ_last10threadfromforum2 but changed it to extract threads from forum#121 and it works as it should.
PHP Code:
SELECT threadid, title, postusername,postuserid,dateline FROM " . TABLE_PREFIX . "thread WHERE sticky=0 AND visible=1 AND forumid=121 ORDER BY dateline DESC LIMIT 10
I duplicated that web query ( $WQ_last10threadfromforum3) and tried to extract the threads from forumid=230 but it didn't work. The resulting display was blank.
PHP Code:
SELECT threadid, title, postusername,postuserid,dateline FROM " . TABLE_PREFIX . "thread WHERE sticky=0 AND visible=1 AND forumid=230 ORDER BY dateline DESC LIMIT 1
... and so I executed an SQL Query and noticed the following error:
So, I did the same with the code that works as it should:
But that one does in fact display the last ten threads from forum#121.
I did try to read the 5.1.72 manual until my eyes crossed and fell out on to my cheeks.
Can you help please?
Logician's WebTemplates 4.0.2
MySQL Version - 5.1.72-cll
vB 4.2.2
|
You can't directly run these SQL queries in applications like phpmyadmin because it has a vbulletin replacement in it. (which is " . TABLE_PREFIX . " ).
So its NORMAL that BOTH of these queries will produce a syntax error when you try to run them "as they are" in tools like phpmyadmin. If you want to run them there, you need to remove " . TABLE_PREFIX . " part and use this query:
PHP Code:
SELECT threadid, title, postusername,postuserid,dateline
FROM thread
WHERE sticky=0 AND visible=1 AND forumid=230
ORDER BY dateline DESC
LIMIT 10
or
PHP Code:
SELECT threadid, title, postusername,postuserid,dateline
FROM thread
WHERE sticky=0 AND visible=1 AND forumid=121
ORDER BY dateline DESC
LIMIT 10
These should run fine in phpmyadmin.
However this still does not explain why your query is not running in webtemplates.

I suspect there is another problem somewhere else rather than the query syntax. I don't know if your webmaster email in config.php file is accurate but if webquery died with a DB error (like syntax error) you would get a DB error notification in your email. Since you didn't get it, I'd think that there is no problem with your webquery.
Blank pages usually means PHP errors and they happen in servers where PHP error display is turned off in php.ini. If it was on, the page would display the error and we would have more clue. Since its off, I don't know what is causing the error but maybe you can check it in your server's php error log. I'd suspect something about the webtemplate your recently created (rather than webquery).
So my first suggestion is, create a new test webtemplate with nothing in it but a simple "hello there
$WQ_last10threadfromforum3" and see if it will also produce a blank page. If it works, then you can understand its somehow related to the content of your other webtemplate (not webquery!). It might be clashing with an other plugin or smt.
It would really help if you enable php error display in server so that we'll see the error message that blank page is suppose to produce.