get list from databse
-
Kindly can you told us how i can get the list from database and assign it for the items ?
let say i add this script
$title_en = array(); // make a new array to hold all your data
function test() {
$title_en = array(); // make a new array to hold all your datamysql_connect(“localhost”, “root”, “”) or
die(“Could not connect: ” . mysql_error());
mysql_select_db(“contactform”);$result = mysql_query(“SELECT title_en FROM districts”);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$data = $row[0];
$title_en[$data] = $data;
}mysql_free_result($result);
return $title_en;
}$items = test();
private static $items = test(); // not working
- The topic ‘get list from databse’ is closed to new replies.