ncix007 Posted April 11, 2006 Share Posted April 11, 2006 hi, i got stuck in some where in my code:i have created database and inserted the information as neededi want to display the information as an array as follows:$admission= array();///example written manaully$admission[0] = array("name" => "ram", "m" => "best","id" => "item", "u1" => "");$admission[1] = array("name" => "kam", "m" => "computer","id" => "code", "u1" => "");$admission[2] = array("name" => "john", "m" => "jam","id" => "sku", "u1" => "");$admission[3] = array("name" => "aanita","m" => "circuit","id" => "oid", "u1" => "");/// i have 4 field in database table as name, m, id, u1i want to parse the list in the above mannercan any body help meregardsncix007 Link to comment https://forums.phpfreaks.com/topic/7089-array-using-database/ Share on other sites More sharing options...
Barand Posted April 11, 2006 Share Posted April 11, 2006 [code]$admissions = array();$sql = "SELECT name, m, id, u1 FROM tablename";$res = mysql_query ($sql) or die(mysql_error());while ($row = mysql_fetch_assoc($res)) { $admissions[] = $row;}[/code] Link to comment https://forums.phpfreaks.com/topic/7089-array-using-database/#findComment-25748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.