xoops forums

xoopdio

Just popping in
Posted on: 2011/10/15 6:59
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#1

mysql query issue

Hi

I got a problem to get a proper answer to a mysql query, even when I follow the "How to build your own XOOPS module" -> "The queries" recomendations :

global $xoopsDB;
$table $xoopsDB->prefix('config');
$sql "SELECT conf_value FROM x3ae_config WHERE conf_title
 IN('_MI_PHPBB3_ROOT_PATH', '_MI_PHPBB3_DB_HOST', '_MI_PHPBB3_DATABASE', 
'_MI_PHPBB3_DB_USER', '_MI_PHPBB3_DB_PASS', '_MI_PHPBB3_USERS_TABLE');"
;

$result $xoopsDB->queryF($sql);

list(
$PHPBB3_ROOT_PATH$PHPBB3_DB_HOST
$PHPBB3_DATABASE$PHPBB3_DB_USER$PHPBB3_DB_PASS$PHPBB3_USERS_TABLE)
 = 
$xoopsDB->fetchRow($result);

echo 
$PHPBB3_ROOT_PATH$PHPBB3_DB_HOST$PHPBB3_DATABASE$PHPBB3_DB_USER,
 
$PHPBB3_DB_PASS$PHPBB3_USERS_TABLE;


All I can get as answer is the first item ($PHPBB3_ROOT_PATH) when the query
answers fine in the mysql shell ?

I tried also :

$rows $xoopsDB->fetchArray($result);
var_dump($rows);


and get only :

array(1) { ["conf_value"]=> string(8"/phpbb3/" }


I guess that I miss something but what ?
Any idea ?

Thank you
"A tree is made of non-tree elements" Thich Nhat Hanh

trabis

Core Developer
Posted on: 2011/10/15 13:05
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#2

Re: mysql query issue

Try:
while($row $xoopsDB->fetchArray($result)) { 
    
var_dump($row);
}

xoopdio

Just popping in
Posted on: 2011/10/16 6:23
xoopdio
xoopdio (Show more)
Just popping in
Posts: 29
Since: 2011/9/27
#3

Re: mysql query issue

Thanks Trabis : It works !

I did see the "when the query returns an array" from the pdf but I didn't think it could apply as it isn't a multidimensional array : I'm really a new newbie !

Thanks again !
"A tree is made of non-tree elements" Thich Nhat Hanh