If you wanted to make sure it completed OK first, you could do something like this:
PHP Code:
function processData($data, $old_data)
{
// if something goes wrong
return false;
// if everything is good
return 'whatever you want';
}
$newdata = processData($data, $old_data);
if ($newdata !== false) {
$mysqli->query("UPDATE assetsEn SET datastring='$newdata', commit=$commit WHERE IDdata=".$catch->IDdata);
}
You could also use the various error/exception functions and classes included in PHP to either trigger an error or throw/catch an exception if something goes wrong in your function.
You should know what your function "should" return. Therefore, if something happens unexpected in your function, you can handle/test for it accordingly.
Bookmarks