0
 echo '<ul>';
            while ($row = mysql_fetch_object($res)) {
                $mes = $row->message;
                $format = "<li class='message'>%s</li>";
                sprintf($format,$mes);
            }
            echo '</ul>';

где тут неправильно

                $mes = $row->message;
                $format = "<li class='message'>%s</li>";
                sprintf($format,$mes);
1
  • 1
    echo sprintf() .... 4 дек 2016 в 9:55

1 ответ 1

2

sprintf() возвращает строку, а не выводит на экран.
Дока http://php.net/manual/ru/function.sprintf.php
Правильно так:

while ($row = mysql_fetch_object($res)) {
            $mes = $row->message;
            $format = "<li class='message'>%s</li>";
            echo sprintf($format,$mes);
        }

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.