I am running the below code to echo the contents of a single row from the MySQL database and it is currently outputting what seems to be twice the output. See below
$result = mysql_query("SELECT * FROM table WHERE this='1'") or die(mysql_error());
$row = mysql_fetch_array($result);
foreach($row as $key => $field) {
if($key != 'id' && $key != 'doss' && $key != ''){
echo "Field name: $key = $field<br />";
$missing =$missing+$field;
}
}
The output is:
Field name: 1 = 0
Field name: go = 0
Field name: 2 = 1
Field name: het = 1
Field name: 3 = 0
Field name: quf = 0
Field name: 4 = 0
Field name: sid = 0
Field name: 5 = 1
Field name: ram = 1
Field name: 6 = 1
mysql_fetch_arraywill produce an array with both numerical keys and associative keys.The default definition is:
If you want to get unique values, use either
MYSQL_ASSOCorMYSQL_NUM