1
kaotik
Dropdown, query DB not working
  • 2004/10/6 0:21

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


HI, I've been tring to populate a dropdown, but can't seem to get the db query to work. Here's what I have:

$results 'SELECT account FROM ' $xoopsDB->prefix('wmfx_popsettings') . ' WHERE id = '1'';
$select_str "";
while (
$opt $xoopsDB->fetchArray($results)) {
$sel $opt['account'];
$select_str .= "$sel'>$seln";
}
echo 
"test";
echo 
$select_str;
echo 
"test";


Can someone help me?

2
Dave_L
Re: Dropdown, query DB not working
  • 2004/10/6 0:30

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


You forgot to do the query.

$results $xoopsDB->query('
   SELECT account
   FROM ' 
$xoopsDB->prefix('wmfx_popsettings') . '
   WHERE id = '
1'
'
);

3
kaotik
Re:Dropdown, query DB not working
  • 2004/10/6 0:53

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I replaced this line:
$results 'SELECT account FROM ' $xoopsDB->prefix('wmfx_popsettings') . ' WHERE id = '1'';

With your code:
$results $xoopsDB->query('
   SELECT account
   FROM ' 
$xoopsDB->prefix('wmfx_popsettings') . '
   WHERE id = '
1'
'
);


Now when I do an echo to see $results, I'm getting this:
Resource id #69

Is this correct or am I doing something wrong?

4
Dave_L
Re:Dropdown, query DB not working
  • 2004/10/6 1:01

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


That's probably correct. The result of a query is a resource ID.

You could try printing $opt inside the loop:

var_dump('opt'$opt);

Login

Who's Online

371 user(s) are online (73 user(s) are browsing Support Forums)


Members: 0


Guests: 371


more...

Donat-O-Meter

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

Latest GitHub Commits