Advertisement
Guest User

Untitled

a guest
Nov 28th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. // make  a  Query  
  5. // make  suer  you  include  set  page  
  6.  
  7. include "set.php";
  8.  
  9. //  display  the  page
  10. //  a  part  of  the  page  
  11. $tpl->display('pagename');  // without  extension
  12. #describe $tpl
  13. // $tpl  is  an  object  
  14. // display(); is the  method  
  15. #  -> is  for  connection
  16. #main  functoions  in  tpl object  
  17.  
  18.  
  19. # database  functions  
  20. // $db  //  object  
  21. // $db->Query(sql statement);
  22. // return  Query object  
  23. // usage  
  24. $query = $db->query($sql);
  25. if($query)
  26.     echo true;
  27. else
  28.     echo  false;
  29.  
  30. // main  what  we  do  is  
  31.  
  32. while($row = $query->fetch_assoc())
  33. {
  34.  
  35.  
  36. }
  37.  
  38. // same  as  
  39. while($row= mysql_fetch_assoc($query))
  40. {
  41.     //do  codes
  42. }
  43.  
  44. //object  way  
  45.  
  46. $num = $query->num_rows;
  47.  
  48. //same  as  
  49. $num = mysql_num_rows($query);
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement