generate array from DB

hi guys, i wanna make a multilingual site that will store all the content in a DB for each language, i want it easy to edit for other persons using a admin panel, that is why i want to use a DB.
The thing that i need to retrive data from the DB and insert it in to array.
and in DB i wanted to do it like this:

|++ID++|++++VAR++ |+++++++VAL+++++++|
|++1++ |+++title+++ |++Welcome to my site++|
|++2++ |++content++ |++some content+++++++|

When i get this from the DB i want it to put it all in array like this:
[php] array( ‘title’ => ‘Welcome to my site’, ‘content’ => ‘some content’);[/php]

okay i found the solution, in case someone else wants to knwo how to do it, here it is how :
[php]<?php
$sql = “SELECT var, val FROM tablename”;
$res = mysql_query($sql);
$myarray = array();

while ($row = mysql_fetch_assoc($res)) {
$myarray[$row[‘var’]] = $row[‘val’];
}
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service