Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8397099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:42:16+00:00 2026-06-09T20:42:16+00:00

I am trying to take data from an array using Facebook Open Graph. I

  • 0

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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:42:18+00:00Added an answer on June 9, 2026 at 8:42 pm

    Replace code with this one. Also read this link

    require_once('OpenGraph.php');
    $urlget2 = "http://www.example.com/article/1/title";
    $graph = OpenGraph::fetch($urlget2);
    $insertvalues = '';    
    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";
    
    //get all insert values
      $insertvalues .= ", ('','".$urlform."','".$subtype."','".$subtitle."','".$subimage."' ,'".$subdesc."','".$subtime."','".$datesubmit."','".$subevent."','".$useridme."','".$facebookidme."','".$grpurl."')";  
    
      echo "<hr />";
      echo $insertvalues;
    }
    echo "<hr />";
    $insertvalues= substr($insertvalues,1); //just takes off the leading comma
    
    $insert3 = "INSERT INTO share VALUES ".$insertvalues;
    echo "<hr />";
    echo $insert3;
    mysql_query($insert3);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to take the data that is returned to me from a
Really struggling to figure this out. Just trying to take in data from php
so i'm trying to do a data migration where i take the listings from
I am trying to take data from one mysql table and insert it in
I am trying to take up data from plist. One row in plist has
I'm trying to take a stream of data from standard in, compress it one
We use a data acquisition card to take readings from a device that increases
I'm trying to retrieve data using the new graph API, however the token I'm
I am trying to find a way to take an array of keywords that
I'm trying to take a VARCHAR(MAX) with data in it as follows: 00001001010001010111010101... etc.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.