daily pastebin goal
78%
SHARE
TWEET

Moshe

a guest Oct 23rd, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PHP JS cheat sheet
  2.  
  3. =====JS:
  4. var input = document.getElementById("inputVal").value;
  5. document.getElementById("").innerHTML = " " + String(input) ;
  6.  
  7. ========= PHP
  8. include("");
  9. session_start();
  10. isset($_POST[''])
  11. unsset($_POST[''])
  12. $_SESSION['']
  13. $GLOBALS['']
  14.  
  15. $_SESSION[''] = base64_encode(openssl_random_pseudo_bytes(32));
  16.  
  17. ============= PHP mysqli
  18. == db login var:
  19. $dbIP =
  20. $dbName =
  21. $dbuser=
  22. $dbpass=
  23.  
  24. == How query look like:
  25. $mysqli = new mysqli($GLOBALS['dbIP'],$GLOBALS['dbuser'], $GLOBALS['dbpass'], $GLOBALS['dbName']);
  26. $query = "";
  27. $mysqli->query($query);
  28. $mysqli->close();
  29.  
  30.  
  31. == while using update/insert/delete statment:
  32. $mysqli->affected_rows > 0
  33.  
  34. == while using select:
  35. $query = "";
  36. $mysqli->query($query);
  37. $result->num_rows
  38.  
  39. == While getting the first row match:
  40. (string)$result->fetch_row()[0];
  41.  
  42. == print the hole answer:
  43.     if($result = $mysqli->query($query)){
  44.        while ($row = $result->fetch_assoc()) {
  45.         printf ("(%s) %s </br>", $row["username"], $row["comment"] );
  46.         }
  47.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top