Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Video {
- public $videoName = "";
- public $videoViews = "";
- public function __construct($videoName, $videoViews) {
- $this->videoName = $videoName;
- $this->videoViews = $videoViews;
- }
- }
- $conectar = mysqli_connect("localhost", "***", "***", "***") or die("Erro 001 - Conection lost");
- if ($conectar->connect_errno) {
- echo "Falha ao conectar com o mysql: (" . $conectar->connect_errno . ") " . $conectar->connect_error;
- }
- $start = isset($_GET['start']) ? $_GET['start'] : 0;
- $data = array();
- $query = "SELECT * FROM videos ORDER BY id DESC LIMIT {$start}, 5";
- $resultado = mysqli_query($conectar, $query);
- while($linhas = mysqli_fetch_assoc($resultado)){
- $data[] = array(
- "videoName" => $linhas['nome'],
- "videoViews" => $linhas['tempo']
- );
- }
- echo json_encode($data);
Advertisement
Add Comment
Please, Sign In to add comment