News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

SQL Syntax Error with SSI.php

Started by Zarabadoo, January 09, 2007, 03:49:15 AM

Previous topic - Next topic

Zarabadoo

SMF Version: SMF 1.1.1
I am at a loss as to why this is happening since other SSI.php functions work fine. The following error is shown when I use the ssi_recentTopics() funtion with the $output_method declared (either 'array' or 'echo'). When I use it vanilla or even declare a $limit, it works fine. It also seems that SMF is catching the error since it is displayed within the SMF template all nicely formatted.

QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
AND 1
AND hxxp:ms.id [nonactive]_MSG = hxxp:t.id [nonactive]_FIRST_MSG
ORDER BY hxxp:t.id [nonactive]_LAST_MSG DESC
LIM' at line 13
File: /xxxxxx/xxxxxx/xxxxxx/forum/SSI.php
Line: 360

The closest I have come in searching the board is this post, but that hasn't been updated in over a year and it was for 1.1B3.

So far I am also able to pull events and welcome information via SSI.php using the array method.

Thanks in advance for any help that you may be able to provide.

Daniel15

Are you sure you're using the correct syntax? Try this:

<?phprequire_once('forums/SSI.php');$topics = ssi_recentTopics(10, null, 'array'); // (number of topics, array of boards to ignore, return type)print_r($topics);?>


Does this work? If not, do you have any mods installed?
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Zarabadoo

Yep, syntax is correct as far as I understand. A little different than your example, but correct. It is more like:


<?phprequire_once('forums/SSI.php');$smf_topics = ssi_recentTopics($limit = 5, $output_method = 'array');print_r($smf_topics);?>


Yours seems to have worked though, so problem solved. The syntax I used worked on the other functions that I currently have implemented. Nutty I tell 'ya.

If anything, my silliness can be a lesson to others. Thanks a bunch for the shove in the right direction.

Daniel15

In your syntax, you're not passing the output method properly. The second argument is the boards to ignore (set to null in my example), and the third argument is the output method. Also, the variable names should not be there. So, that line should look like:

$smf_topics = ssi_recentTopics(5, null, 'array');
Daniel15, former Customisation team member, resigned due to lack of time. I still love everyone here :D.
Go to smfshop.com for SMFshop support, do NOT email or PM me!

Zarabadoo

I saw it listed that way in the SSI FAQs elsewhere in the forums. It is in the correct format now, though. Now I am happily sorting through the arrays putting what I want where I want.

Advertisement: