Advertisement
adrianoschneider

Teste Código PHP

Aug 16th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * @author Adriano Schneider
  5.  * @copyright 2017
  6.  */
  7.   //
  8.   $conexaoDB = mysqli_connect("localhost:3317", "root", "123456", 'android_rest');
  9.   //
  10.   $query  = "select ID";  
  11.   $query .= "     , NOME";
  12.   $query .= "     , EMAIL";
  13.   $query .= "     , CELULAR";
  14.   $query .= "     , STATUS";
  15.   $query .= "  from usuarios";
  16.   $query .= " limit 0,10";
  17.   $result = mysqli_query($conexaoDB,$query);
  18.   $_qtdeRegistros = mysqli_num_rows($result);
  19.   $lista = array();
  20.   while ($row = mysqli_fetch_array($result)) {
  21.     extract($row);
  22.     $lista[] = array(
  23.       "id" => $ID,
  24.       "nome" => $NOME,
  25.       "email" => $EMAIL,
  26.       "celular" => $CELULAR,
  27.       "status" => $STATUS
  28.     );
  29.   }
  30.   mysqli_close($conexaoDB);
  31.   //
  32.   echo json_encode($lista);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement