How to pull data from a MySQL column and put it into a single array
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2010-04-20T23:55:08Z
Indexed on
2010/04/21
3:03 UTC
Read the original article
Hit count: 352
Basically, this is what I currently use in an included file:
$sites[0]['url'] = "http://example0.com";
$sites[1]['url'] = "http://example1.com";
$sites[2]['url'] = "http://example2.com";
$sites[3]['url'] = "http://example3.com";
$sites[4]['url'] = "http://example4.com";
$sites[5]['url'] = "http://example5.com";
And so I output it like so:
foreach($sites as $s)
But I want to make it easier to manage via a MySQL database. So my question is, how can I make it automatically add additional "$sites[x]['url'] = "http://examplex.com";" and output it appropriately from my MySQL table?
© Stack Overflow or respective owner