Ok I have this problem. I want a bit of code to return one value if a record is not found in the database, but return another value when the record IS found in the database.
For instance, if there is no record with the username "test", then I want the code to return one value.. for example "test.jpg". However, if the value "test" IS found in the database, I want it to return "found.jpg" instead.
Is this right?
$result = mysql_query("SELECT * FROM pictures2 WHERE username='$username' and position='2'");
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
if (!$result) {
$pic_2 = "test.jpg";
}
else {
$pic_2 = "found.jpg";
}
}
If a record containing the username "test" is found with the value "2" in field "position" then it returns true (found.jpg). But if it's not found, it should return "test.jpg"