Skip to content

Instantly share code, notes, and snippets.

View jaffreyjoy's full-sized avatar
👁️
Staring at progress bars...

Jaffrey jaffreyjoy

👁️
Staring at progress bars...
View GitHub Profile
@jaffreyjoy
jaffreyjoy / js-php.js
Last active August 24, 2019 03:44
PHP <--> JS (data)
//send data to a php file using AJAX
$.ajax({
type: 'POST',
url: 'del_table.php',
data: {'variable': myval},
});
@jaffreyjoy
jaffreyjoy / login.php
Last active April 6, 2018 15:49
PHP basic authentication
<?php
if(isset($_POST["login_btn"])) {
$conn = new mysqli("localhost","id3320560_root_lol","lol1234","id3320560_organd");
if($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$username = $_POST["username"];
@jaffreyjoy
jaffreyjoy / update.php
Last active April 6, 2018 15:49
PHP - update & file upload
<?php
$conn = new mysqli("localhost","id3320560_root_lol","lol1234","id3320560_organd");
if($conn->connect_error)
die("Connection failed".$conn->connect_error);
$name = $_POST["name"];
$username = $_POST["username"];
$email = $_POST["email"];
@jaffreyjoy
jaffreyjoy / pdf-pages.php
Last active April 6, 2018 15:48
PHP and python script for finding no. of pgs in a pdf
/*
First function requires an executable called pdfinfo.exe
Alternative function using python script needs PyPDF2 package to be installed
*/
<?php
// Make a function for convenience
function getPDFPages($document)
{
@jaffreyjoy
jaffreyjoy / sql_commands_with_syntax_and_description.sql
Last active August 25, 2018 06:55
List of all commands (with detailed info) for the SQL workshop . Happy Querying :) Feel free to post any queries
-- is used for single line comment
/* some sql code */ -> is used for multiline comment
--CREATE A DATABASE
--SYNTAX : CREATE DATABASE db_name;
CREATE DATABASE STUDENT;