I would like to ask question. My condition now is like that, my user login into my android application with using facebook and after login they will go to the page which is allow them to select item. After select the item, they will view their selection in status page. In the status page , every account only will see their selection only. Now my one is every account selection will display together in status page and what i want is every account's status page will display their selection only. I am using localhost and php to write selection page and status page code. So, how i can do to make my application know which facebook user login to my app since i don't has login php.
Below is my selection and status page php
Selection page:
<?php
if($_SERVER['REQUEST_METHOD']=='POST'){
//Getting values
$username = $_POST['username'];
$name = $_POST['name'];
$date = $_POST['date'];
//Creating an sql query
$sql = "INSERT INTO Selection (username, name, date) VALUES
('$username','$name', '$date')";
//Importing our db connection script
require_once('dbConnect.php');
//Executing query to database
if(mysqli_query($con,$sql)){
echo 'Select Successfully';
}else{
echo 'Sorry, You Are Select This Item Before';
}
//Closing the database
mysqli_close($con);
}
?>
Status Page:
<?php
//Importing Database Script
require_once('dbConnect.php');
//Creating sql query
$sql = "SELECT * FROM Selection" ;
//getting result
$r = mysqli_query($con,$sql);
//creating a blank array
$result = array();
//looping through all the records fetched
while($row = mysqli_fetch_array($r)){
//Pushing name and id in the blank array created
array_push($result,array(
"id"=>$row['id'],
"username"=>$row['username'],
"name"=>$row['name'],
"date"=>$row['date']
));
}
//Displaying the array in json format
echo json_encode(array('result'=>$result));
mysqli_close($con);
?>
Thank You.