Saturday, 7 September 2013

How to fetch all of my selected data and echo it with a while loop? Only fetching one record

How to fetch all of my selected data and echo it with a while loop? Only
fetching one record

$sqlWork = "SELECT * FROM work WHERE user_id = '$_SESSION[user_id]'";
$resultWork = $connection->query($sqlWork);
$rowWork = $resultWork->fetch_assoc();
I currently have this table.
(I would add an image if I had the reputation)
http://imgur.com/fEYrzY0
This is how I am outputting my data.
do {
echo "{$rowWork['work']}";
} while ($description = mysqli_fetch_array($resultWork));
Any help would be appreciated. Thank you.

No comments:

Post a Comment