Home>

HTML tags are automatically generated from information obtained from DB.
$res = $mysqli->query ($spl);has an error and cannot be resolved.
Please lend me your help.

<? php
$mysqli = new mysqli ('●●. ●●. ●●. ●●', '●●●●●●●●', '●●●●●●●●', '●●●●');
function creative_tags ($sql, $mysqli) {
    $res = $mysqli->query ($spl);
    if ($res->num_rows) {
        while ($data = $res->fetch_array (MYSQLI_ASSOC)) {
            foreach ($data as $key =>$val) {
                $$key = $val;
                if ($key == "created_at") {
                    // cut down $data time
                    // (1): Extract only `` Year-Month-Day '' from variable $date
                    $date = substr ($$key, 0,10);// when counting from before
                }
            }
            $aging_list. =<<<EOF
        <li>
            <a href = "/ contents.php/detail? list_bbbb {$head_catch}">
                <div>
                    <img src = "{$img1_1}" alt = "">
                </div>
                <time>{$date}</time>
                <p>
                    {$head_catch}
                </p>
                <p>
                    {$head_body}
                </p>
            </a>
        </li>
EOF;
        }
    }
    return $aging_list;
}

if ($_ GET ["a_prm"] == "toilet") {
    print_r ($_ GET ["a_prm"]);
    $sql =<<<EOF
select *
from aging_table
order by trouble_id desc
EOF;
$toilet_list = creative_tags ($sql, $mysqli);
}


Error details

<b>Warning</b&gt ;: mysqli :: query (): Empty query in<b>/export/sd07/www/jp/r/e/....... .../aging_list.php</b>on line<b>13</b><br />


I went:
-Even if you try to describe $res = $mysqli->query ($spl);in the function, the same error
-I checked with php My admin whether there is a record with the contents described in the SQL statement, but there is a corresponding record.