php MySQL fetch printing double?
When I make a sql query and echo it out it repeats the first row twice
$sql = 'SELECT one,two,three FROM justAnExampleForSO where one = one';
$info = mysql_query(sql);
if(mysql_num_rows($info )>0){
while ($row = mysql_fetch_array($info )) {
foreach($row as $key => $var)
{
if($key == 'one')
echo $var.",";
else if($key == 'two')
echo $var.",";
else if($key == 'three')
echo $var.";";
}
}
}
so for example say I am attempting to get cols one, two, three When the
output is echoed it would echo
one, one, two,three;
I am not sure if this is a duplicate of this question or not because I
couldn't full understand his problem. Fetch array function doubling values
in each position of array?
No comments:
Post a Comment