I have got a small php function that does not return any value that I can see and I seek your assistance
function getAllVotes($id) {
$votes = array();
$q = "SELECT * FROM $tbl_name WHERE id = $id";
$r = mysql_query($q);
if (mysql_num_rows($r)) {
$row = mysql_fetch_assoc($r);
$votes[0] = $row['vvotes_up'];
$votes[1] = $row['vvotes_down'];
}
return $votes;
}
// $id = $_POST['id'];
$id = 3;
$cur_votes = getAllVotes($id);
echo $cur_votes[1];
?>
now the
echo $cur_votes[1];
does not print any thing on my screen how ever the $cur_votes actually is an array and I can confirm that by
echo $cur_votes;
Which returns " Array "
I don't understand why $cur_votes[1]; does not return me any thing. Could you please help me ? thanks.
var_dump($cur_votes);?echo $cur_votes[0];$tbl_namedefined?