I don't know the right way to use IF THEN ELSE
Posted: Sun Jun 26, 2005 4:27 pm
Hi,
Can anyone help me with my query result output?
Firstly, here is a snippet from the query, and I have no problems: -
Secondly, here is the display output: -
Now, the result works fine, but the IF statement doesn't do anything. It simply jumps to the Else statement and prints out the list of Artists. The problem is matching up the contents of the IF statement with something similar in the Query string itself.
I would like to know how to match up the
("select Artistimages as Have")
statement from the query with the
IF ( Have == 'yes' )
statement within the While loop.
Can anyone help me with that?
d11wtq | Please can you read the sticky about posting code in the forums? We have
Can anyone help me with my query result output?
Firstly, here is a snippet from the query, and I have no problems: -
Code: Select all
$result = mysql_db_query("select Artist, ArtistImages as Have")Code: Select all
<?php
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
IF ( Have == 'yes' )
{
print("<a href='../Track Notes/{$row['HL_Artist']}'>{$row['Artist']}</a>");
}
ELSE
{
print("{$row['Artist']}");
echo "<br>";
}
}
?>I would like to know how to match up the
("select Artistimages as Have")
statement from the query with the
IF ( Have == 'yes' )
statement within the While loop.
Can anyone help me with that?
d11wtq | Please can you read the sticky about posting code in the forums? We have
Code: Select all
tags, and no such [mysql] tags [/color]