Guest User

Moshe

a guest
Oct 23rd, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XBasic 1.02 KB | None | 0 0
  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.     }
Add Comment
Please, Sign In to add comment