PHP Warning: mysql_num_rows() expects parameter 1 to be resource at line x. I checked for all single quotes missing and sql link .
$v = html_entity_decode($v);
$query_1 = sprintf("select part_of_speech_id from word_parts_of_speech where word = '%s'", mysql_real_escape_string($v));
$res = Commons::query($query_1) ;
if(mysql_num_rows($res) != 0){
while ($row = mysql_fetch_assoc($res)) {
if($row['part_of_speech_id']!=15){//see table down for reference
$query_url = "insert into freetext_keywords(RANDOM_ID,URL,TAG_NAME,KEYWORD) values('$random_id','$url','$tagName','$v') on duplicate key update WEIGHT = WEIGHT + 1";
$result = Commons::query($query_url);
}
}
}else{
$query_url = "insert into freetext_keywords(RANDOM_ID,URL,TAG_NAME,KEYWORD) values('$random_id','$url','$tagName','$v') on duplicate key update WEIGHT = WEIGHT + 1";
$result = Commons::query($query_url);
}
}
Just echo the MySql query in php and run against the database in phpmyadmin (I hope you are using phpmyadmin to access your database)
And see if the query execute well and return result. If it shows any errors, please correct your query accordingly.
<?php
echo $query_1 = sprintf("select part_of_speech_id from word_parts_of_speech where word = '%s'", mysql_real_escape_string($v));
?>
Copy the query from the browser and run directly against database.