I've just started a new job and have quite a bit of free time available and thought it would be a good idea to use it productively so i thought i would have a poke and prod and try to learn PHP with MySQL.
I've made good progress this week, connecting to db's, creating tables, using SELECT, UPDATE, WHERE but have hit a little brick wall when i've tried to do the following.
$result = mysqli_query($con, "SELECT apples FROM users2 WHERE username='$_POST[user1]'
OR username='$_POST[user2]' ORDER BY apples DESC");
while($row = mysqli_fetch_array($result))
echo "<table border='1'>
echo "<td>" . $row['apples'] . "</td>";
I get what i want and expect in that i get a table with the results i asked for.
I've had a brainwave/brainfart however of using $result to perform a small calculation. Such like user1's apples minus users'2 apples then display that result, so somehow I have to get the values out of $result and work with them. If i can't use $result from the above MySQL statement or my PHP syntax how could i do it differently?
I am grateful for any pointers in the right direction.
I hope this makes sense!