i’ve got a query and i try to get some results like this:
while ($keywords = mysql_fetch_array($keys1)){
foreach ($keywords as $key) {
$pos2 = strripos($key, $dquote);
if ($pos2 === false) { } else {
$clean_dquote = str_replace('"', "", $key);
print_r($clean_dquote);
echo '<br>';
}
}
}
the raw result from the while loop will be :
"test"
"test1"
i am using str_replace to make it look like this:
test
test1
what happens is that i get back:
test
test
test1
test1
is that because i use a while and a foreach?, but if i take one out i don’t get no results
any ideas?
thanks
As said in http://cn.php.net/manual/en/function.mysql-fetch-array.php
Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows.
The type of returned array depends on how result_type is defined. By using MYSQL_BOTH (default), you’ll get an array with both associative and number indices. Using MYSQL_ASSOC, you only get associative indices (as mysql_fetch_assoc() works), using MYSQL_NUM, you only get number indices (as mysql_fetch_row() works).