Else statement if Fetch returns no results
Hope you're all well.
Below i'm obtaining data from the database to display inside a <select> form which is basically a profile which displays the profile name. What I want to do is if a profile does not exist to do an ELSE statement... i've tried a few ways but have not no success... how could I do this?
Currently, if the data cannot be obtained the form doesn't appear...
If anyone could assist, that would be appreciated.
$query = "SELECT * FROM individual_profile WHERE username = '$username'";
$propertyid = $_SESSION["propertyid"];
if ($query_run = mysql_query($query))
while ($query_row = mysql_fetch_assoc($query_run))
$fname = $query_row['fname'];
$lname = $query_row['lname'];
echo '<div class="agent"> Seller:
<select name="seller" class="agentlist" tabindex="2">
<option value="'.$fname.'"'.$lname.'">'.$fname.' '.$lname.'</option></select></div></div></form>';
// Else echo 'Please create a profile';