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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:29+00:00 2026-06-15T07:34:29+00:00

I got two files name func.inc.php and profile.php I’m trying to fetch the data

  • 0

I got two files name func.inc.php and profile.php
I’m trying to fetch the data from the mysql by creating a function get_data($id) in func.inc.php and display in the profile page(profile.php).But the data is not displaying.

<– func.inc.php file –>

<?php session_start();
function  get_data($id){
$query_in="SELECT * FROM user WHERE id ='$id'";
$query=mysql_query($query_in);
while($row=mysql_fetch_assoc($query)){
    $name=$row['name'];
    $book=$row['book'];
    $mobile=$row['mobile'];
    $computer=$row['computer'];
}

} 
?>

<– profile.php –>

<? 
include'func.inc.php';
echo "Name: ".$name;
echo "Book: ".$book;?>
  • 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-15T07:34:31+00:00Added an answer on June 15, 2026 at 7:34 am

    The function should return some value then only the values from the function will be got

       function  get_data($id){
        $query_in= sprintf("SELECT * FROM user WHERE id ='%d'", mysql_real_escape_string($id));
        $query=mysql_query($query_in);
        $result = array();
        while($row=mysql_fetch_assoc($query)){
            $result[]['name'] = $row['name'];
        }
        return $result;
        } 
    

    <– profile.php –>

    $values = get_data($id);
    
    print_R($values);
    

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

Sidebar

Related Questions

I've got two font files like: FONT-light and FONT-bold. Both come from @font-face kit
I've got two txt files consisting of names (1st) and surnames (2nd). I'm trying
I'am trying to write simple script that will get files name from one folder
While adding two language code files i.e. C# and VB.NET to App_Code, got an
I got two data storages in my Windows Azure account. One is for the
I got two projects running, both written in PHP. Now I want to merge
I am working on a project with hibernate. I got these two files: Persoon.java
I got two DLL files in the GAC. DLL file A references DLL file
I've got two header files, each requiring a type defined in the other. When
I have discovered the following code appear in two identical .php files on more

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.