Guest User

Untitled

a guest
Jul 20th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <?
  2. function db_query($query) {
  3. global $connection;
  4. $result = mysql_query($query, $connection);
  5. if ($result) {
  6. $output = array();
  7. while ($row = mysql_fetch_array($result)) {
  8. if (mysql_num_rows($result) == 1 ) {
  9. $output = $row;
  10. } else {
  11. array_push($output, $row);
  12. }
  13. }
  14. return($output);
  15. }
  16. else {
  17. die ("Bad MySQL Request");
  18. }
  19. }
  20. //Funcion que te ahorra muchas lineas para hacer un request...
  21. //Ahora, invocas la funcion y te devuelve los resultados en un Array para tu comodidad :D
  22. ?>
Add Comment
Please, Sign In to add comment