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 Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.