PHP 警告:mysql_num_rows() 期望参数 1 是第 x 行的资源。我检查了所有缺少的单引号和 sql 链接。
$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);
}
}