这是我在这里的第一篇文章。我有一张桌子,我从facebook页面收集id。我有另一张表,我收集有关这些页面的所有信息。 我的问题是:如何通过json_decode(graph.facebook.com/id)将第一个表中的id传递给第二个表?我不知道如何制作它。谢谢大家,我很抱歉我的英语不好。这是我的add.php: `
if (!isset($addid))
{
?>
<form action="add.php">
Page/App ID: <input type="text" name="id">
<input type="submit" value="Submit">
<form>
<?php
}
else
{
$url = "http://graph.facebook.com/" . $addid;
$geturl = file_get_contents($url);
$info = json_decode($geturl);
$pagetype = $info->icon_url;
if ($pagetype == '')
{
$id = $info->id;
$name = mysql_real_escape_string($info->name);
$website = mysql_real_escape_string($info->website);
$username = mysql_real_escape_string($info->username);
$description = mysql_real_escape_string($info->description);
$about = mysql_real_escape_string($info->about);
$talking_about_count = $info->talking_about_count;
if ($talking_about_count == '') { $talking_about_count = 0; }
$category = mysql_real_escape_string($info->category);
$link = mysql_real_escape_string($info->link);
$likes = $info->likes;
$date = date("Y-m-d H:i:s");
if ($likes == '') { $likes == 0; }
?>
<form action="add.php">
Page/App Name/ID: <input type="text" name="id">
<input type="submit" value="Submit">
<form>
<br>
<br>
<br>
<div>
Info about this page: <?php echo $name . " (" . $id . ")"; ?> <br><br>
ID: <?php echo $id; ?> <br>
Name: <?php echo $name; ?> <br>
Website: <?php echo $website; ?> <br>
Username: <?php echo $username; ?> <br>
Description: <?php echo $description; ?> <br>
About: <?php echo $about; ?> <br>
Talking about count: <?php echo $talking_about_count; ?> <br>
Category: <?php echo $category; ?> <br>
Link: <?php echo $link; ?> <br>
Likes: <?php echo $likes ?> <br>
Image: <img src="http://graph.facebook.com/<?php echo $id?>/picture"> <br><br>
Added on: <?php echo $date; ?><br><br><br>
<br>
<br>
Adding info in database...
<br>
<?php
$query = "INSERT INTO pages (id, name, website, username, description, about, talking_about_count, category, link, likes, addedon) VALUES ($id, '$name', '$website', '$username', '$description', '$about', $talking_about_count, '$category', '$link', $likes, $date)";
mysql_query($query);
echo "Done";
echo "</div";
?>
`