In the following php code, I am getting the above error. $strings
stores the fields coming from database as an array. So why is this error coming? Can someone tells me the solution for this problem, please.
$db_selected = mysql_select_db("chatter",$con);
$mvsql="Select body from feed";
$str=mysql_query($mvsql,$con);$i=0;
while($strings=mysql_fetch_array($str)){
echo $strings["body"] . "<br>";
}
require_once __DIR__ . '/../autoload.php';
$sentiment = new \PHPInsight\Sentiment();
foreach ($strings as $string) {
// calculations:
$scores = $sentiment->score($string);
$class = $sentiment->categorise($string);
// output:
echo "String: $string\n";
echo "Dominant: $class, scores: ";
print_r($scores);
echo "\n";
}