Jump to content

PHP While loop / MySQL Data


advancedfuture

Recommended Posts

So the below is my attempt at pulling multiple bits of data from the database.... so far the only value that is returning anything useful is $RESUME. What am I doing wrong here? Thankx!

 

$query = "SELECT resume, firstname, lastname, interests FROM profile WHERE username = '$username'";
$results = mysql_query($query);
$num = mysql_num_rows($results);
while($row = mysql_fetch_array($results))
{
$RESUME = $row[0]; //GLOBAL RESUME
$FIRSTNAME = $row[1];
$LASTNAME = $row[2];
$INTERESTS = $row[3];
}

Link to comment
https://forums.phpfreaks.com/topic/85124-php-while-loop-mysql-data/
Share on other sites

<?php
$query = "SELECT resume, firstname, lastname, interests FROM profile WHERE username = '$username'";
$results = mysql_query($query);
$num = mysql_num_rows($results);
while($row = mysql_fetch_array($results))
{
echo $row[0].", ".$row[1].", ".$row[2].", ".$row[3];
}
?>

Does that do any good?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.