rhyspaterson Posted May 27, 2007 Share Posted May 27, 2007 Hey guys, Simple question here, but i'm a bit stuck. I use the following code: ftp_chdir($conn_id, $destination) I want to use an IF statement that says if the ftp_chdir command is not successful, then run some commands, else (therefore if it works), run some different commands. But i seriously am stuck as to how to write the statement. Any help would be greatly appreciated. Cheers, /Rhys Quote Link to comment https://forums.phpfreaks.com/topic/53130-basic-if-question/ Share on other sites More sharing options...
dustinnoe Posted May 27, 2007 Share Posted May 27, 2007 <?php $chdir = ftp_chdir($conn_id, $destination); if (!$chdir) { //Execute failure code } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53130-basic-if-question/#findComment-262444 Share on other sites More sharing options...
dmIllithid Posted May 27, 2007 Share Posted May 27, 2007 Try the following : <?php if (!ftp_chdir($conn_id, $destination)) { // new commands here. } ?> This will do the same thing as what dustinnoe posted, the difference is that with this script, you don't have to create and populate a new variable. Quote Link to comment https://forums.phpfreaks.com/topic/53130-basic-if-question/#findComment-262450 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.