Olavius Posted April 2, 2012 Share Posted April 2, 2012 Hello, For an assignment I have to insert tweets into a database specified by a number of search terms. For now it all seems to work, but there is one thing we can't filter. For some reason our English/Dutch searchterms sometimes insert Chinese tweets into our database. We need to delete those using triggers. Does anybody have any idea how to fix that? Quote Link to comment Share on other sites More sharing options...
cpd Posted April 2, 2012 Share Posted April 2, 2012 Is it your own database? Quote Link to comment Share on other sites More sharing options...
Olavius Posted April 3, 2012 Author Share Posted April 3, 2012 Yes it is! But we've already got it working now;) Quote Link to comment Share on other sites More sharing options...
fenway Posted April 9, 2012 Share Posted April 9, 2012 Yes it is! But we've already got it working now;) That's nice -- how? Quote Link to comment Share on other sites More sharing options...
Olavius Posted April 9, 2012 Author Share Posted April 9, 2012 Yes it is! But we've already got it working now;) That's nice -- how? We made a filter of acceptable characters, but we they dropped the assignment to use a trigger for it. The only little problem was that it sometimes filtered HTTP-links, but our teacher didn't mind that This is the script: <?php function test_language($text){ $allowed = str_split("abcdefghijklmnopqrstuvwxyzàáäéèëÈÉÊËÌÍÎÏÁÙÚ^1234567890,./;’‘[]\-=~!@#$%^&*()_+{}|`:\"?><€ "); $count = 0; for($i=0;$i<=strlen($text);$i++){ for($j=0;$j<=count($allowed);$j++){ if(substr($text,$i,1)==$allowed[$j]){ $count++; break; } } } if(strlen($text) == $count){ return true; } else { return false; } } ?> Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted April 9, 2012 Share Posted April 9, 2012 that's terribly inefficient. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 14, 2012 Share Posted April 14, 2012 that's terribly inefficient. And that's why it's important to post "solutions". Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted April 15, 2012 Share Posted April 15, 2012 that's terribly inefficient. And that's why it's important to post "solutions". nah Quote Link to comment 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.