如何使用php mysqli_fetch_assoc访问mysql别名值?

时间:2017-04-03 02:36:59

标签: php mysql

我试图使用php获取mySQL值,但它不起作用。我在查询中使用别名。这是我的代码:

$selectedFeature = mysqli_query($db, "SELECT * FROM(SELECT * FROM token_preprocessing_latih WHERE id_term<=5112 ORDER BY tf_idf_normalisasi DESC) AS selectedFeature GROUP BY term ASC")or die(mysqli_error($db)); 

    $feature = $feature*100;
    while ($row = mysqli_fetch_assoc($selectedFeature)) {
        $term = $row['term'];
        $bobot = $row['tf_idf_normalisasi'];

        mysqli_query($db,"INSERT INTO selected_feature VALUES('','$term','$bobot','$feature')")or die(mysqli_error($db));
    }

我已在我的数据库中检查$term$bobot值。它显示我的查询插入了错误的值。有人能告诉我如何解决它吗?谢谢。

0 个答案:

没有答案