[Mediawiki-l] Problems with SQL2wiki extension in template

Jan Steinman Jan at Bytesmiths.com
Wed Jul 8 07:44:59 UTC 2009


> From: Jean-Marc van Leerdam <j.m.van.leerdam at gmail.com>
>
> 2009/7/7 Jan Steinman <Jan at bytesmiths.com>:
>> I'm having trouble using the SQL2wiki extension in a template.
>>
>> Something seems to be goofy about the use of a parameter. The
>> parameter is not getting the value it is supposed to get, and the
>> MySQL error messages seem to indicate that one of the curly braces is
>> getting stripped off:
>>
>> Here is the template with as simple a query as I could muster;  
>> user_id
>> 2 is a valid record:
>>
>>> ? ? <noinclude>{{project timelog1|2}}</noinclude>
>>> ? ? <includeonly><sql2wiki database="EcoReality">SELECT * FROM
>>> mw_user WHERE user_id = {{{1}}}</sql2wiki></includeonly>
>>
>> and here is what is produced, error messages in front of an empty  
>> table:
>>
>>> ? ? Warning: mysql_query() [<a href='http://www.mysql.com/doc'>http://www.mysql.com/doc
>>> </a>]: You have an error in your SQL syntax; check the manual that
>>> corresponds to your MySQL server version for the right syntax to use
>>> near '{{1}}}' at line 1 in [full path deleted]/mediawiki-1.13.3/
>>> extensions/SQL2Wiki.php on line 42
>>>
>
> I have no experience with this extension, but aren't user_id's
> strings? In that case, the {{{1}}} probably needs some quotes around
> it.

Hi, Jean-Marc,

Thanks for that thought. I have already tried it.

When there are double or single quotes around the formal parameter, I  
have no error message, but the parameter is not passed. It is as if an  
empty string is passed, based on what is produced in the resulting  
output.

(BTW: the user_id is an integer in the database, and when I run it  
with quotes around the formal parameter, it returns results for  
used_id = 0, no matter what is passed in as the actual parameter.)

:::: If voting could change anything, it would be illegal. -- Russell  
Means ::::
:::: Jan Steinman, EcoReality http://www.EcoReality.org ::::



More information about the MediaWiki-l mailing list