News:

Wondering if this will always be free?  See why free is better.

Main Menu

Convert Query for smf 2

Started by edi67, November 13, 2008, 01:47:20 PM

Previous topic - Next topic

edi67

sorry for question, i know that smf 2.0 have new dq query structure so i searched for solve but not found solution, i need to convert this query:

$request = db_query("
SELECT groupName, ID_GROUP
FROM {$db_prefix}membergroups
WHERE ID_GROUP != 3
AND minPosts = -1
AND ID_GROUP != 1
ORDER BY minPosts, IF(ID_GROUP < 4, ID_GROUP, 4), groupName", __FILE__, __LINE__);
$context['member_groups'] = array(0 => &$txt['admin_register_group_none']);
while ($row = mysql_fetch_assoc($request))
$context['member_groups'][$row['ID_GROUP']] = $row['groupName'];
mysql_free_result($request);


and transform it for work with SMF 2.0

somebody can help me ?
CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Oldiesmann

Quote from: edi67 on November 13, 2008, 01:47:20 PM
sorry for question, i know that smf 2.0 have new dq query structure so i searched for solve but not found solution, i need to convert this query:

$request = db_query("
SELECT groupName, ID_GROUP
FROM {$db_prefix}membergroups
WHERE ID_GROUP != 3
AND minPosts = -1
AND ID_GROUP != 1
ORDER BY minPosts, IF(ID_GROUP < 4, ID_GROUP, 4), groupName", __FILE__, __LINE__);
$context['member_groups'] = array(0 => &$txt['admin_register_group_none']);
while ($row = mysql_fetch_assoc($request))
$context['member_groups'][$row['ID_GROUP']] = $row['groupName'];
mysql_free_result($request);


and transform it for work with SMF 2.0

somebody can help me ?


$request = $smcFunc['db_query']('
SELECT group_name, id_group
FROM {db_prefix}membergroups
WHERE id_group != {int:mod_group}
AND min_posts = {int:negative_one}
AND id_group != {int:admin_group}
ORDER BY min_posts, CASE WHEN id_group < {int:four} THEN {int:four} ELSE id_group END, group_name', array('mod_group' => 3, 'negative_one' => -1, 'admin_group' => 1, 'four' => 4));
$context['member_groups'] = array(0 => &$txt['admin_register_group_none']);
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['member_groups'][$row['id_group']] = $row['group_name'];
$smcFunc['db_free_result']($request);
Michael Eshom
Christian Metal Fans

edi67

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Advertisement: