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 6891283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:23:25+00:00 2026-05-27T06:23:25+00:00

So I’m working on app that involves leveraging user profile data from FB. But

  • 0

So I’m working on app that involves leveraging user profile data from FB. But not all users maintain the same data, so I’m using functions to determine which data is missing and then request the appropriate data from the user. These requests come from a database. A basic example of the function looks like this:

  function getEmploymentInfo () {
        if (isset($this->employer) and (!isset($this->jobtitle))) {
            $id = 1;
        } elseif (!isset($this->employer)) {
            $id = 2;
        }
        echo $this->get_profile($id);
    }

And the get profile function looks like this:

 function get_profile($id) {
$dsn = "mysql:host=localhost;dbname=software";
$username = "root"; // database username
$password = "*******"; // database password
try {
    $enter = new PDO($dsn, $username, $password);
    $sql = "SELECT response FROM getprofile WHERE response_id = ? ";
    $new_item = $enter->prepare($sql);
            $new_item->setFetchmode(PDO::FETCH_ASSOC);
    $new_item->execute(array($id));
    foreach($new_item as $nw) {
        return $nw['response'];
    }
} catch (Exception $e) {
    echo $e->getMessage();
    exit;
}
return "";
    }

And $id=1 coming from the database looks like this:

 <script type="text/javascript">

 function getJobTitle(){
document.getElementById("JobTitle").hidden = true;
document.getElementById("two").hidden = false;

}

 function getStartDate(){
document.getElementById("StartDate").hidden = true;
document.getElementById("three").hidden = false;

}

function getEndDate(){
document.getElementById("EndDate").hidden = true;
document.getElementById("four").hidden = false;

}

<?php
echo "$objUser->employer";
?>
<form action="newprofile.php" method="post">
<p><a id="JobTitle" href="#" onclick="getJobTitle()">Add Job Title</a><input       type="text" name="jobtitle" id="two" hidden="true" value="Add Job Title"></input></p>
<p><a id="StartDate" href="#" onclick="getStartDate()">Add Start Date</a><input    type="text" name="startdate" id="three" hidden="true" value="Add Start Date"></input></p>
<p><a id="EndDate" href="#" onclick="getEndDate()">Add End Date</a><input type="text"   name="enddate" id="four" hidden="true" value="Add End Date"></input></p>
<input type="submit" value="submit"></form>

But when this code returns from the database to the page echo “$objUser->employer”; doesn’t populate. Meanwhile if I write that code directly on the page it works. What gives?

  • 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-05-27T06:23:25+00:00Added an answer on May 27, 2026 at 6:23 am

    Databases just store text, not actual instantiated objects. The returned value has no way of knowing what $objUser was when you stored all that text.

    There’s a lot of things wrong with the way you’re trying to go about doing this, you shouldn’t be storing all that code in the database for every row. But the most simple way to answer this and point you in the right direction, is that you need to serialize objects in order to store them in the database, and unserialize them after pulling the record out of the database, in order to use them again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a text area in my form which accepts all possible characters from
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.