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 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 } ?> 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. Link to comment https://forums.phpfreaks.com/topic/53130-basic-if-question/#findComment-262450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.