我回显时,PHP mysql查询无法正常工作

时间:2018-08-20 23:46:55

标签: php mysql

我尝试用PHP进行查询,但我认为我犯了一个错误。 当我连续回声时,我看到任何东西,您能帮我吗? :)

MYSQL-表格:

+----+-------+--------------------+----------+--------+
| id | user  |       tool         | waarde   | status |
+----+-------+--------------------+----------+--------+
| 1  | BEN   | ticker_text        | #FFF     |      1 |
| 2  | BEN   | ticker_background  | #00aeef  |      1 |
+----+-------+--------------------+----------+--------+

PHP:

$user = $_GET['user'];
$text_sql = "SELECT * FROM optie WHERE user='$user' AND tool='ticker_text'";
$text_row = $mysqli->query($text_sql);
echo $text_row['waarde'];

1 个答案:

答案 0 :(得分:4)

您需要从查询中获取结果集,然后对其进行迭代:

$result = $mysqli->query($text_sql);
while ($text_row = $result->fetch_array()) {
    echo $text_row['waarde'];
}