Good time to all

I have a table and I want to display several records at once on the page and not one, what do I need to do for this?

I would be happy to follow the example or links, thanks anyway

  • one
    SELECT * FROM table LIMIT 15 display all columns from the table table for the first fifteen entries SELECT * FROM table LIMIT 5, 15 display all columns from the table table for fifteen records, skipping the first five (that is, from the sixth to the twentieth) - etki

1 answer 1

  /* Подключение к серверу MySQL */ $mysqli = new mysqli('localhost', 'root', '1234','database'); /* Хост, к которому мы подключаемся */ /* Имя пользователя */ /* Используемый пароль */ /* База данных для запросов по умолчанию */ $mysqli->set_charset("utf8"); if (mysqli_connect_errno()) { printf("Подключение к серверу MySQL невозможно. Код ошибки: %s\n", mysqli_connect_error()); exit; } /* Посылаем запрос серверу */ if ($result = $mysqli->query('SELECT id, tema FROM blog ORDER BY id DESC LIMIT 5')) { print("Список статей:<br> \n"); /* Выбираем результаты запроса: */ while( $row = $result->fetch_assoc() ){ printf("%s (%s)\n", $row['id'], $row['tema']); } /* определение числа рядов в выборке */ $row_cnt = $result->num_rows; printf("В выборке %d рядов.\n", $row_cnt); /* Освобождаем память */ $result->close(); } /* Закрываем соединение */ $mysqli->close(); 
  • this is the minimum to get a request from the MySQL database using the mysqli library. - Shilgen