Creating an array, within an array, with mysql
Posted: Tue Feb 15, 2005 7:22 am
Basically Im going to put this function @ the top of the page and it will define the $swears array, I can then use this array to parse posts.
Anyway, the static part of the function works fine - however I am having trouble getting the database part to work!
Static
but for the database part Ive tried everything but it just returns stuff like "Array ( [0] => [1] => ) "
The code
Ideas?
Anyway, the static part of the function works fine - however I am having trouble getting the database part to work!
Static
Code: Select all
$swears = array(
array('<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>', 'f*ck'), array('<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>', 'sh*t'), array('bitch', 'b*tch'), array('slut', 'sl*t'), array('wank', 'w*nk'), array('twat', 'tw*t'),
array('cunt', 'c***'), array('bastard', 'bast*rd'), array('<span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span>', 'p*ss'), array('cock', 'chicken'), array('dick', 'd*ck'),array('whore', 'wh*re'));The code
Code: Select all
$query = query("SELECT word, replacement FROM $unzDB.unz_swearbot");
$swears = array();
while ($row = mysql_fetch_array($query, MYSQL_ASSOC))
{$swears = array("$row->word", "$row->replacement");}