Okay first off, here's my function for sending a query:
function send_query($sql) {
global $rows;
global $conn;
connect();
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$rows[] = $row;
}
mysqli_free_result($result);
$conn->close();
return $rows;
}
And when I use it like this:
$rows = send_query("SELECT views FROM posts WHERE postid = " . $_GET['id']);
foreach( $rows as $row ) {
print_r($row);
echo "<BR>";
}
I get this result...
Array ( [postid] => 1 [username] => jesusfreak [unique] => 3 )
Array ( [views] => 0 )
Why is it putting the answer I need in [1] of the array instead of [0]? And why is it putting those other things that I didn't request into [0]?