oracle259 Posted September 25, 2006 Share Posted September 25, 2006 How do i create an array from a mysql result. So far i have tried thiswhile ($res = mysql_fetch_array($result, MYSQL_BOTH) {$link[] = $res[item];}echo $link[];but that doesnt seem to work.any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 25, 2006 Share Posted September 25, 2006 instead of echo $link, you need to loop thru the array[code]foreach ($link as $item) echo $item.'<br/>';[/code] Quote Link to comment Share on other sites More sharing options...
Gaoshan Posted September 26, 2006 Share Posted September 26, 2006 The array is created automatically by mysql_fetch_array. To step through that array just use:[code]while ($row = mysql_fetch_array($result)) { echo $row[0], $row[1], $row[2]; }[/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.