I have tried several combinations, including foreach, do whiles. This works
when i submit the values one by one, but when i try to automatize it it wont
work. Thanks

mysql_select_db($database_MBTTIENDA, $MBTTIENDA);
$query_prefsname = "SELECT Pref_name FROM mtmbt_prefs";
$prefsname = mysql_query($query_prefsname, $MBTTIENDA) or
die(mysql_error());
$row_prefsname = mysql_fetch_assoc($prefsname);

mysql_select_db($database_MBTTIENDA, $MBTTIENDA);
$query_prefsvalue = "SELECT Pref_value FROM mtmbt_prefs";
$prefsvalue = mysql_query($query_prefsvalue, $MBTTIENDA) or
die(mysql_error());
$row_prefsvalue = mysql_fetch_assoc($prefsvalue);

// merging them into the new array $MTMBT
foreach($row_prefsvalue as $i => $v)
{
     $MTMBT[$row_prefsname[$i]] = $v;
}

// printing result
foreach($MTMBT as $k => $v)
{
     echo "\$MTMBT[$k] => $v.<br>";
}

echo "the end lets see the results";
print_r($MTMBT);
echo "<br>";
echo $MTMBT['Titulo'];

<snip - snip>
<[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hello Elliot,
>
> On 11 Mar 2004 at 23:55, Elliot J. Balanza wrote:
>
> > I need to make a query to a MySQL database that only has two fields,
name &
> > value. That I can do.
> >
> > Then I need to store the values i receive in an array in the form of:
> >
> > $variable['name'] = value;
> >
> > But haven't been able to do it neither with a foreach nor with a do
while...
> > Can anyone please assist me?
>
> Assuming you've read the introductory sections of the PHP manual and are
not trying to
> get other people to spend their time on your project so that you won't
need to spend
> yours, please show us your code so that we can help you spot the problem.
>
> Erik

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to