Forum Moderators: coopster
I am really stumped and need a fresh set of eyes!
Can anyone help?
[php]
// make the query to get the members info
$query5 = "select profile_id, profile_complete, validated from matrimonial WHERE username='$_SESSION[username]'";
$result5 = @mysql_query ($query5);
while($row5=mysql_fetch_array($result5))
{
if ($row5['validated'] == '1') {
echo '<li><a href="matrimonial-view.php?profile=' . $row5['profile_id'] . '" class="gen">View your profile</a><br />';
} else {
echo '<li><a href="my-profile.php" class="gen">Add your profile</a><br />';
}
}
[/php]
This code should be echoing 'view your profile' or 'add your profile' depending on the result of the query, for some unknown reason it is echoing nothing?
I have worked out that if there are no results for the query, nothing is printed if there is 'View your profile' is printed.
So I am guessing that my if else or the if ($row5['validated'] == '1') { is constructed wrong.
If there are no results for th query I want it to print the other line.
if($row5=mysql_fetch_array($result5))
{
if ($row5['validated'] == '1') {
echo '<li><a href="matrimonial-view.php?profile=' . $row5['profile_id'] . '" class="gen">View your profile</a><br />';
} else {
echo '<li><a href="my-profile.php" class="gen">Add your profile</a><br />';
}
}
else {
the text to show if no info
}
if($row5=mysql_fetch_array($result5)) clause will return false if no rows and will execute else clause