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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:53:55+00:00 2026-06-11T19:53:55+00:00

SOLVED: The error had nothing to do with require or include. It was completely

  • 0

SOLVED: The error had nothing to do with require or include. It was completely unrelated to the question. Sorry about that. 🙁

I thought I had an understanding of require/include until now. I have a file named file_one that has something like this, $user_data = return_user_data_as_array(). My second file file_two, calls $user_data. Now, when I do a include 'file_two.php' into the file_one page after the functions and variables have been called, the page returns with undefined variable user_data. I thought that if you include/require a file into your php code it would pick up any variables written in the original file? How would I fix this?

Edit: I also want to mention that although the undefined variable error is popping up on my screen, the “undefined” variables are correctly echoed out.

File One

//this require_once holds the function user_data()

require_once 'core/init.php';

$user_id = 1;

$profile_data = user_data($mysqli, $user_id); 

//this calls file two
require_once 'file_two.php';

File Two or file_two.php

echo $profile_data['full_name'];
  • 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-11T19:53:56+00:00Added an answer on June 11, 2026 at 7:53 pm

    The answer had nothing to do with the problem in the question. The code in the question is correct.

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

Sidebar

Related Questions

My question is not about how to solve this error(I already solved it) but
I had a similar question some days ago that was solved, but now, some
Ive had a similar question as this one before, and when that solved this
I read this question and thought that would easily be solved (not that it
I recently asked a question about the same function, that solved my probelem and
Alrighty, I'm getting quite frustrated, namely because I thought I had this issue solved,
EDIT: Problem solved: Stupid little twit that I am, I had neglected to give
(edit: On subsequent edit, the poster declared that the problem had been solved and
I had a problem that was partially solved. To explain it quickly : I
How to solved error Unable to cast object of type 'System.Int32' to type 'Microsoft.DirectX.Direct3D.VertexShader'

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.