Guest User

Untitled

a guest
Jan 17th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. function one(){
  2. $query = "SELECT * FROM table WHERE id='$id'....";
  3. $result = mysql_query($query);
  4. while($row=mysql_num_rows($result))
  5. {echo "$row[data]";} }
  6.  
  7. function(something here, and here){then the result here?}
  8.  
  9. function simplify() {
  10.  
  11. $query = "$crud * FROM $table WHERE id= '$id' ";
  12. $result = mysql_query($query);
  13. while($row=mysql_fetch_array($result)) {echo "$row[data]";}
  14.  
  15.  
  16. }
  17.  
  18. echo simlify(and here would be table name, id, select, create, update...) {
  19.  
  20. and here the result}
  21.  
  22. $db = new DBAdapter(array('host' => 'localhost'));
  23. $results = $db->Select('mytable')->Where('id > 2')->Execute();
  24.  
  25. class DBAdapter extends PDO
  26. {
  27. public function __construct( array $params)
  28. {
  29. // construct the connection
  30. }
  31.  
  32. public function Select ($table)
  33. {
  34. // do stuff for a table select
  35. return $this;
  36. }
  37.  
  38. public function Count ($table)
  39. {
  40. // do stuff for a table count
  41. return $this;
  42. }
  43.  
  44.  
  45. public function Where ($condition)
  46. {
  47. // do stuff for a where
  48. return $this;
  49. }
  50.  
  51. public function Execute ()
  52. {
  53. // execute stuff
  54. return $result;
  55. }
  56. }
Add Comment
Please, Sign In to add comment