Maybe its a dublicate but every Situation is different :)
I get a String from Ajax Request and handle it to this function
function convertHashtags($str){
$text = $str;
$regex = '/#(\w+)/';
preg_match_all($regex, $text, $allMatches, PREG_SET_ORDER);
foreach ($allMatches as $matches) {
$engine->checkHashtag($matches[0]);
}
$regex2 = "/#+([a-zA-Z0-9_]+)/";
$str = preg_replace($regex2, '<a href="hashtag.php?tag=$1">$0</a>', $str);
return($str);
}
Then i want in the for each that for every Result the Engine is inserting it to Database. When i comment out the Engine line then its working. return $matches[0]; is working too!
This is my Engine function code
function checkHashtag($tag) {
return true;
}
And at least here is my Error Message...
500 (Internal Server Error)send
@ jquery-1.10.2.js:8706jQuery.extend.ajax
@ jquery-1.10.2.js:8136(anonymous function)
@ (index):797jQuery.event.dispatch
@ jquery-1.10.2.js:5095jQuery.event.add.elemData.handle
@ jquery-1.10.2.js:4766
Why is it not working ?
*What is $Engine ? *
A included Class
require_once('../PATH/engine_class.php');
$engine = NEW engine_class();