Logician Posted November 6, 2011 Share Posted November 6, 2011 Is it possible to use if() with a file? I am trying to use it like this. if (./blue.png) {echo "blue.png<BR>";} Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/ Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 if(is_file(./blue.png)) { //do whatever } Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/#findComment-1285478 Share on other sites More sharing options...
Logician Posted November 6, 2011 Author Share Posted November 6, 2011 Arghhh!!! I just tried: if(file()) ... so close! Thanks haku! Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/#findComment-1285479 Share on other sites More sharing options...
Logician Posted November 6, 2011 Author Share Posted November 6, 2011 What I am trying to do is use: if (is_file(./products/$row['gender']/blue.png)) {echo "blue.png";} $row['gender'] is causing a problem. I have tried: {$row['gender']} {.$row['gender'].} .$row['gender']. but they didn't work. drat! Do you know whats wrong? Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/#findComment-1285480 Share on other sites More sharing options...
haku Posted November 6, 2011 Share Posted November 6, 2011 if (is_file('./products/' . $row['gender'] . '/blue.png')) {echo "blue.png";} Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/#findComment-1285481 Share on other sites More sharing options...
Logician Posted November 6, 2011 Author Share Posted November 6, 2011 ah har! Thanks again haku, it worked a treat! Link to comment https://forums.phpfreaks.com/topic/250552-using-if-with-a-file/#findComment-1285486 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.