Guest User

Untitled

a guest
Jul 7th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. $DB_CON;
  3. function DBConnect($print)
  4. {
  5. /* INSERT MYSQL SETTINGS HERE */
  6.  
  7. $host="127.0.0.1";
  8. $username="root";
  9. $password="";
  10. $database="artur";
  11.  
  12. /* Make a connection to MySQL and select database */
  13.  
  14. $GLOBALS['DB_CON']=mysql_connect($host,$username,$password);
  15. if(!$GLOBALS['DB_CON'])
  16. die('Database ERROR: ' . mysql_error());
  17.  
  18. mysql_select_db($database,$GLOBALS['DB_CON']);
  19.  
  20. }
  21. function DBClose()
  22. {
  23. mysql_close($GLOBALS['DB_CON']);
  24. }
  25.  
  26. function DBQuery($sql)
  27. {
  28. DBConnect();
  29. $result= mysql_query($sql);
  30. DBClose();
  31. return $result;
  32. }
  33. $result= DBQuery("SELECT * FROM moridim");
  34. ?>
Add Comment
Please, Sign In to add comment