[support] Block php errors from Drupal Logs

Saint-Genest Gwenael gwenael.saint-genest at makina-corpus.com
Fri Jun 6 16:36:35 UTC 2008


   Set vars directly into SQL query is not a good choice (see [1]). You
can set $user->uid as parameter and '%d' into SQL string. I'm not sure
that's your error but you can try with this syntax.

Gwen

[1] http://api.drupal.org/api/function/db_query/5

Neil: esl-lounge.com wrote:
> Hi,
> 
> this is put into a block code text box, with php code filter applied. Here 
> is the whole block code:
> 
> <?php
> global $user;
> $result=db_query("SELECT content_type_nodeprofile.field_country_value, 
> users_1.name, users_1.uid
> FROM ((users INNER JOIN content_type_nodeprofile ON users.uid = 
> content_type_nodeprofile.field_uid_value) INNER JOIN 
> content_type_nodeprofile AS content_type_nodeprofile_1 ON 
> content_type_nodeprofile.field_country_value = 
> content_type_nodeprofile_1.field_country_value) INNER JOIN users AS users_1 
> ON content_type_nodeprofile_1.field_uid_value = users_1.uid
> WHERE (((users.uid)=$user->uid) AND ((users_1.uid)<>$user->uid)) ORDER BY 
> users_1.uid DESC LIMIT 5;
> ");
> while ($u = db_fetch_object($result)) {
> $items[]="<li class=\"member-list\">";
> $items[]="<a class=\"members-link\" href=\"user/$u->uid\">$u->name</a>";
> $items[]="&nbsp;<a 
> href=\"/search/user-search?filter1=$u->field_country_value\" 
> class=\"geo-link\">$u->field_country_value</a>";
> $items[]="</li>";
> }
> return theme('front_page_geo_blocks', $items, "From my country");
> ?>
> 
> is the problem the ordering of my filters for the php filter? Where would I 
> need to place the html_entity_decode() to prevent the code getting mangled? 
> I don't understand how the blocks are performing as per design if the code 
> is getting altered? :-S
> 
> Thanks
> 
> Neil

-- 
Gwenael Saint-Genest
MAKINA CORPUS - www.makina-corpus.com
44 boulevard des Pas Enchantés FR-44230 Saint Sébastien sur Loire
Tel : +33 (0) 2 40 94 96 08


More information about the support mailing list