I have a class and inside that class is this function which has a select statement in it
class homeclass {
function viewHome(){
$connection = mysql_connect("localhost","will","Idontknow!1");
if (!$connection){
die('Could not connect: ' . mysql_error());
}
$db = mysql_select_db("willr", $connection);
$query = "select id, text, image from home";
$results = mysql_query($query, $connection);
$results = mysql_fetch_array($results);
return $results;
$close = mysql_close($connection);
}
}
I call that function in another file which is inside a case...like so
case"updatehome":
$homeArray = $home->viewHome();
print_r($homeArray);
break;
When I do a print_r statment I get this back...
Array ( [0] => 1 [id] => 1 [1] => Test Header [text] => Test Header [2] => test.jpg [image] => test.jpg )
My question is why am I getting eveything twice? I dont understand