1
xoopdio
mysql query issue
  • 2011/10/15 6:59

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


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

2
trabis
Re: mysql query issue
  • 2011/10/15 13:05

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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

3
xoopdio
Re: mysql query issue
  • 2011/10/16 6:23

  • xoopdio

  • Just popping in

  • Posts: 29

  • Since: 2011/9/27


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

Login

Who's Online

122 user(s) are online (69 user(s) are browsing Support Forums)


Members: 0


Guests: 122


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits