MI6

PHPAMF query service

MI6
Nov 18th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. <?php
  2.  
  3. class mysqlQueryAMF
  4. {  
  5.     public function __construct()
  6.     {
  7.         mysql_connect("server", "username", "password");
  8.         mysql_select_db("database");
  9.     }
  10.  
  11.     /**
  12.      * Retrieves data from vNations MYSQL database
  13.      * @returns query results
  14.      */
  15.      
  16.     function makeQuery($table, $request ="*", $conditionals = "")
  17.     {
  18.         if($conditions !== "")
  19.             $conditions = " WHERE ".$conditionals;
  20.         else
  21.             $conditions = "";
  22.            
  23.         $queryString = "SELECT ".$request." FROM ".$table.$conditions;
  24.         return mysql_query($queryString);
  25.     }
  26. }
  27.  
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment