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>";} Quote 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 } Quote 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! Quote 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? Quote 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";} Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.