I am trying to take data from an array using Facebook Open Graph. I am getting the array using a foreach statement, but that is making 6 different INSERT statements. I would like each value from the array to be able to be submitted into one MYSQL line.
Note that $insert2 is inserting 6 different lines and $insert 3 is inserting one line, but just $urlform.
Any help would be greatly appreciated.
The code is:
require_once('OpenGraph.php');
$urlget2 = "http://www.example.com/article/1/title";
$graph = OpenGraph::fetch($urlget2);
foreach ($graph as $key => $value) {
$array = array($key => $value);
print_r($array);
$key = type;
$key1 = title;
$key2 = image;
$key3 = description;
$key4 = url;
$subtype = $array[$key];
$subtitle = $array[$key1];
$subimage = $array[$key2];
$subdesc = $array[$key3];
$urlform = $array[$key4];
$useridme = "5";
$insert2 = "INSERT INTO share VALUES('','$urlform','$subtype','$subtitle','$subimage','$subdesc','$subtime','$datesubmit','$subevent','$useridme','$facebookidme','$grpurl')";
echo "<hr />";
echo $insert2;
}
echo "<hr />";
$insert3 = "INSERT INTO share VALUES('','$urlform1','$subtype','$subtitle','$subimage','$subdesc','$subtime','$datesubmit','$subevent','$useridme','$facebookidme','$grpurl')";
echo "<hr />";
echo $insert3;