Skip to content

Instantly share code, notes, and snippets.

@vinay13
Last active September 23, 2015 14:46
Show Gist options
  • Select an option

  • Save vinay13/93ebcb48f9b9078fa3ea to your computer and use it in GitHub Desktop.

Select an option

Save vinay13/93ebcb48f9b9078fa3ea to your computer and use it in GitHub Desktop.
<?php
/* include db.config.php */
include_once(‘includes/config.php’);
//@required_once();
// Get user id
$id = isset($_GET['id']) ? mysql_real_escape_string($_GET['id']) : “”;
if(empty($id)){
$reponse['user']=array();
}
else {
// get user data
$sql = “SELECT * FROM post where userid=’$user_id’”;
$select = mysql_query($sql);
$repo = array();
while($row = mysql_fetch_array($rows)) {
$user = array();
$user['userid']=$row['user_id'];
$user['username']=$row['name'];
$user['emailID']=$row['emailID'];
$user['total_post']=$row['total_post']
array_push($respo,$user)
}
$response['user']=$respo;
}
echo json_encode($response);
mysql_close($conn);
/* JSON Response */
header(‘Content-type: application/json’);
echo json_encode($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment