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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:02:56+00:00 2026-06-09T06:02:56+00:00

Having a function defined in commons.php desktop.php -> include commons.php | | \|/ include

  • 0

Having a function defined in commons.php

desktop.php -> include commons.php
    |
    |
   \|/
    include MODULES.'mod.php'

I can call my custom function anywhere I want, but not inside an exit that’s inside an if. The code where calling the function won’t go:

Mod.php:

....
$error = mysql_error();

if($_ADM['id_user']==1) {
    if(!empty($error)) {
        $debug = array(
                    'message' => "SQL Error in infography_edit module.",
                    'line'    => '79',
                    'error'   => $error,
                    'SQL'     => $SQL
                );
        //exit(myPrint($debug)); //Calling here myPrint does not work
          exit(print_r($debug)); //This works
     }
 }

 $test = array('alex');
 exit(myPrint($debug)); //Calling here myPrint works

....

// The output error: Call to undefined function myPrint()

I just can’t understand why anywhere else outside the code above works, but not inside it without defining it again inside

UPDATE

Doing it this way, doesn’t seem to work either:

myPrint($debug);
exit();
// The output error: Call to undefined function myPrint()

UPDATE2

desktop.php the main file:

  1. require(LIBS.’commons.php’);
  2. common html
  3. include module

Codepad containing desktop’s code: http://codepad.org/hn8QlHQ9

  • 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-09T06:02:57+00:00Added an answer on June 9, 2026 at 6:02 am

    Ok, first of all I have to clarify that the code I was working on, wasn’t mine, I was just hired to make some improvements and had to talk to the main developer to explain that chaos.

    What I kept missing is that every request (every single one that had to do with a page refresh) was going through a secondary file called do.php which eventually loaded the module that I was at, again.

    Visual explication:

    Currently at          Action                Pre-Processor        Processor 
    -------------    =>   ---------------   =>  -------------    =>  ---------
    add_users.php         post from form        do.php               add_user.php
    

    Now, just so you know, current module location (http://site.com/module?=add_users) is saved in a session and do.php has a few lines of code to check that session and include back the module if everything ok. I know it’s a huge mess, but I can’t do nothing about it.

    So, eventually I had to go to do.php and add this following line around the beginning of the file: require_once('libs/commons.php');

     

    My recommendation

    Whenever you see that a function doesn’t load, but you know it loads perfectly in certain cases, look for any other file that might interfere as do.php does above, and try including/requiring the file that contains the function.

    I know things like those can give headaches, but it is what it is and most of the time is not our fault, but the way the platform was already written.

    Good luck to all

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

Sidebar

Related Questions

I'm trying to call a user-defined MATLAB function from a C application, but I'm
I am having trouble getting a variable from one defined function to another. For
I'm having a problem with scala generics. While the first function I defined here
Having php code: function getChildren($parent_id = 0) { .... return $SomeChildrenArray; } And Smarty
I want to write a Module Arg[f_,n_] that takes a function f (having <=n
I'm having trouble getting my user defined function operating properly. I am running on
I am having the bellow function . Here i want to return ajax success
I am currently having an issue with using a function defined as a const
i'm having trouble trying to define this function-like macro, which takes 4 vector magnitudes
I'm trying to define a delegate function that will return an IEnumerable. I'm having

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.