I've a slight problem with my while loop. Although it is doing exactly as it is suppose to, I relized something. I need to contact the MySQL database, find the value of every line with a given username, then show the content of each of those lines one by one. I thought maybe an array or something, but I'm really not sure.
Current code:
// $rows is the number of MySQL rows with '$userName' as the reciver.
$x = "0";
while ($x < $rows) {
// Query the Database:
$sql = "select * from pm where reciver = '$userName'";
$result = mysql_query($sql,$conn) or die("Query fail."
;
// PM Information Vars
$id = mysql_result ($result, 0, 'id');
$sender = mysql_result ($result, 0, 'sender');
$subject = mysql_result ($result, 0, 'subject');
$date = mysql_result ($result, 0, 'date');
$list = "<tr>\n";
$list .= "<td>$sender</td>\n";
$list .= "<td><a href=$v?content=Members/pm/index.php&action=read&id=$id>$subject</a></td>\n";
$list .= "<td>$date</td>\n";
$list .= "</tr>\n";
++$x;
}
Current code:
// $rows is the number of MySQL rows with '$userName' as the reciver.
$x = "0";
while ($x < $rows) {
// Query the Database:
$sql = "select * from pm where reciver = '$userName'";
$result = mysql_query($sql,$conn) or die("Query fail."
// PM Information Vars
$id = mysql_result ($result, 0, 'id');
$sender = mysql_result ($result, 0, 'sender');
$subject = mysql_result ($result, 0, 'subject');
$date = mysql_result ($result, 0, 'date');
$list = "<tr>\n";
$list .= "<td>$sender</td>\n";
$list .= "<td><a href=$v?content=Members/pm/index.php&action=read&id=$id>$subject</a></td>\n";
$list .= "<td>$date</td>\n";
$list .= "</tr>\n";
++$x;
}