doudou201701 2015-12-27 00:30
浏览 44

当我清楚地给出一个数组中的单个条目时,PHP MySQL给我'数组到字符串转换错误'

So here is the error that I'm getting in my browser: Apparently my SQL query has a variable array in it...

Here is my code, including line 158:

for($i = 0; $i < count($sortbyperiod); $i++) {
    $queryname = "SELECT name FROM '" . $sortbyperiod[$i] . "' ORDER BY year ASC, month ASC, day ASC";
    $result = $con_classdata->query($queryname);
    $row = mysqli_fetch_array($result);
    $names = $row['name'];

The variable $sortbyperiod[$i] is clearly a single entry. Why is it giving me an array?

EDIT: Please do not give me PDO solutions, I prefer using mysqli. EDIT 2: Text code instead of image.

  • 写回答

0条回答 默认 最新

    报告相同问题?