When I try to query some content from certain table under certain column, The echo result shows two values, one with the key 0 and other with the key name of the column.
My code is like this :
$query = “select id from nepal_posts”;
$queryExe = mysql_query($query, $connection);
while ($fetched = mysql_fetch_array($queryExe)) {
foreach ($fetched as $key => $value) {
echo $key."----->".$value." ";
}
}
and result was like this :
0—–>9 id—–>9 0—–>10 id—–>10
Why there is two times repetition ?
How should I code, to get proper result ?
my db table is like :
id -> 9, 10 title -> About Us / Om Oss, Our Services / VÃ¥r Verksamhet
post -> bla bla, bla bla
Use
mysql_fetch_assoc()instead ofmysql_fetch_array()