-
Notifications
You must be signed in to change notification settings - Fork 0
/
pointsajaxrequest.php
31 lines (26 loc) · 1.32 KB
/
pointsajaxrequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
//--------------------------------------------------------------------------
// Example php script for fetching data from mysql database
//--------------------------------------------------------------------------
$host = "databaseinstance.cmpvv7vrynza.us-west-2.rds.amazonaws.com";
$user = "arregoitiaJ1";
$pass = "Iamiamiam123";
$databaseName = "earthlinks";
$tableName = "Users";
//--------------------------------------------------------------------------
// 1) Connect to mysql database
//--------------------------------------------------------------------------
include 'DB.php';
$con = mysql_connect($host,$user,$pass);
$dbs = mysql_select_db($databaseName, $con);
//--------------------------------------------------------------------------
// 2) Query database for data
//--------------------------------------------------------------------------
$userid = mysql_escape_string($_GET['userid']);
$result = mysql_query("SELECT Points FROM $tableName WHERE ID = '".intval($userid)."'"); //query
$array = mysql_fetch_row($result); //fetch result
//--------------------------------------------------------------------------
// 3) echo result as json
//--------------------------------------------------------------------------
echo json_encode($array);
?>