the_oliver Posted January 6, 2007 Share Posted January 6, 2007 Hello. Im running the folloging code and its not doing quite what i want. When i run a command through the shell_exec() function i want to decide what happens next, based on whethe anything was returned. Eg, if the code is to create a file, and it works, there should be no responce, and thus i want to carry on, after deleting the database row. However if something is retured, (for example, 'directory already exists') then i want it it update the database and break;The problem is it alway reacts as if nothing has been returned. Can anyone help?[code]foreach($c as $value) { $return = shell_exec($value); if ($return == "") { $remove = "DELETE FROM table WHERE id LIKE $id"; pg_query($pg_connection, $remove); } Else { $error_report = "UPDATE table SET error = 'Error: ".$return."' WHERE id = '".$id."'"; break; } }[/code]- Thanks Quote Link to comment https://forums.phpfreaks.com/topic/33147-return-from-shell_exec-in-if-statment/ Share on other sites More sharing options...
grumm3t Posted February 1, 2007 Share Posted February 1, 2007 This thread is a bit old but I am having this same problem on an IIS6/PHP5 setup. Nothing, even if the command succeeds or fails, is returned.Did you ever manage to figure this out the_oliver? Quote Link to comment https://forums.phpfreaks.com/topic/33147-return-from-shell_exec-in-if-statment/#findComment-174232 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.