I'm attempting to parse through an array of DB fields and values but am not getting the results desired. If I use the following code, the parsing doesn't increment properly.
<?php
mysql_connect("localhost", "root", "jdr0606");
mysql_select_db("phpgallery45");
$result = mysql_query("SELECT * FROM categories");
$rs=mysql_fetch_array($result);
$tmparr=COUNT($rs);
$i=0;
foreach($rs as $key=>$value)
{
echo $key." = ".$value."<br>";
$i=$i+1;
}
mysql_free_result($result);
mysql_close();
?>
I end up with the following results:
0 = 120
categoryid = 120
1 = Babies
catdescription = Babies
2 = 0
highercategoryid = 0
What I want to get is:
categoryid = 120
catdescription = Babies
highercategoryid = 0
What am I doing wrong?
Thanks