Skip to content

Instantly share code, notes, and snippets.

View ElectApp's full-sized avatar

SomsakElect ElectApp

View GitHub Profile
package com.somsakelect.sqltesting;
import android.app.ProgressDialog;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/name"
<?php
//Thank SQL: https://www.w3schools.com/sql/sql_delete.asp
// https://www.tutorialspoint.com/mysqli/mysqli_delete_query.htm
$servername = "localhost"; //ใช้ localhost กรณี server อยู่บน online
$username = "พิมพ์ที่นี่"; //username ของ DirectAdmin
$password = "พิมพ์ที่นี่"; //password ของ DirectAdmin
$dbname = "test"; //ชื่อ database
<?php
//Thank SQL: https://www.w3schools.com/sql/sql_where.asp
$servername = "localhost"; //ใช้ localhost กรณี server อยู่บน online
$username = "พิมพ์ที่นี่"; //username ของ DirectAdmin/phpMyAdmin
$password = "พิมพ์ที่นี่"; //password ของ DirectAdmin/phpMyAdmin
$dbname = "test"; //ชื่อ database
// Create connection
<?php
//Thank: https://www.w3schools.com/php/php_mysql_insert.asp
$servername = "localhost"; //ใช้ localhost กรณี server อยู่บน online
$username = "พิมพ์ที่นี่"; //username ของ DirectAdmin/phpMyAdmin
$password = "พิมพ์ที่นี่"; //password ของ DirectAdmin/phpMyAdmin
$dbname = "test"; //ชื่อ database
// Create connection
@ElectApp
ElectApp / get-user-table-json.php
Last active March 18, 2019 03:48
PHP script for reading table on MySQL database
<?php
$servername = "localhost"; //ใช้ localhost กรณี server อยู่บน online
$username = "พิมพ์ที่นี่"; //username ของ DirectAdmin/phpMyAdmin
$password = "พิมพ์ที่นี่"; //password ของ DirectAdmin/phpMyAdmin
$dbname = "test"; //ชื่อ database
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
public class MainActivity extends AppCompatActivity {
TextView readText;
EditText writeText;
String name = "Test";
String TAG = "Main";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"