mysqli_fetch_row not fetching

Hello all. working on getting a good understanding of php
just created a database & simple poll connection on my godaddy acct (if you want to also refer me to better hosts who have 24hrs phone svc simple wp install feel free)
so anyway…
the database connection is sound…but when i went to test retrieving data nothing is retrieved. @ http://www.danielamorescalchi.com/db_test/testConn.php

<?php include 'conn.php'; ?>
<?php
$query = "SELECT * FROM poll";
$result = mysqli_query($connection, $query);
if(!$result){
	die("dbase query failed");
}
?>
<html>
<head>
<title>test conn</title>
</head>
<body>
[COLOR="#B22222"]<?php
while($row = mysqli_fetch_row($result)){
	var_dump($row);
	echo "<hr />";
}
?>[/COLOR]
<?php
mysqli_free_result($result);
?>
</body>
</html>
<?php
mysqli_close($connection);
?>

but i see nothign wrong in the code. using same dbase con & table for http://www.danielamorescalchi.com/db_test/poll01.php
and while the database is sound it can’t update the vote.
Could you please advs?
Thank you
D

Looks like your query is working but there are issues with the formatting. Viewing the source you can see content is not in the <body> tags. A number of quotes are escaped that shouldn’t be, e.g. \" and </form> tag inside table etc. Can’t really address any “Update the vote” as POST processing code is not shown. Fix code first then deal with processing.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



connected to the database













<table><tr><td><b>Results:</b><table>
<tr><td>-1</td><td>Snow...ho soooo pretty</td></tr>
<tr><td>-1</td><td>White, cold, hell</td></tr>
<tr><td>-1</td><td>thank God its over</td></tr>
<tr><td>-1</td><td>Saw a Yeti!!!</td></tr>
<tr><td>-1</td><td>Hated it so dam much</td></tr>
<tr><td>-1</td><td>whatever</td></tr></table></td><td><b>What did you think of this recent snow event?</b><form method=\\"post\\" action=\\"\\" ><table border=\\"0\\" /><tr><td><label><input type='radio' name=\\"poll\\" value=\\"0"\\ />Snow...ho soooo pretty</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"1"\\ />White, cold, hell</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"2"\\ />RAD, fun I loved it</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"3"\\ />thank God its over</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"4"\\ />Saw a Yeti!!!</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"5"\\ />Hated it so dam much</label></tr></td><tr><td><label><input type='radio' name=\\"poll\\" value=\\"6"\\ />whatever</label></tr></td></table> <input type='submit' name='submit' value=' cast your vote' /></form></td></td></table><html>
<head>
<title>poll 01</title>
</head>

<body>

</body>

</html>
</body>
</html>

Drummin ,appreciate that. but if we could take a look at http://www.danielamorescalchi.com/db_test/testConn.php first?
it has a simple var_dump request. why isnt that one working?
Thank you
D

Any better moving query and fetch together?

<?php include 'conn.php'; ?>
<html>
<head>
<title>test conn</title>
</head>
<body>
<?php
$query = "SELECT * FROM poll";
$result = mysqli_query($connection, $query);
if(!$result){
	die("dbase query failed");
}
while($row = mysqli_fetch_array($result)){
	var_dump($row);
	echo "<hr />";
}
mysqli_free_result($result);
?>
</body>
</html>
<?php
mysqli_close($connection);
?>

Hello Dimmer, nope. I also just created another table successfully, tried calling it but that is also not showing up…

Could you post your conn.php file, removing username and password?

Never mind…much embarrassment. just got it two work w/my second table.
after i inserted values in the new table they showed up…http://www.danielamorescalchi.com/db_test/testConn.php
apologies…i thought i would get the table fields even if they were empty, just the titles…evidently not. Sorry have used wp but had not actually conncted and created my own db outside of some basic localhost.
Thank you though!

of course now have to figure out why the poll table is not working…