1
我想问问。我现在的状况就是这样,我的用户使用Facebook登录到我的android应用程序,登录后他们将进入允许他们选择项目的页面。选择项目后,他们将在状态页面中查看他们的选择。在状态页面中,每个帐户只会看到他们的选择。现在我的一个是每个帐户选择都会在状态页面中一起显示,我想要的是每个帐户的状态页面将只显示其选择。 我使用localhost和php来编写选择页面和状态页面代码。所以,我怎么能让我的应用程序知道哪些Facebook用户登录到我的应用程序,因为我没有登录PHP。状态页面显示由特定的Facebook帐户选择的选择
下面是我的选择和状态页PHP
选择页:
<?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);
}
?>
状态页:
<?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);
?>
谢谢。