#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0

    Variable declaration


    Is it possibile to store the php file name in a variable like $a=a.php instead of calling it explicitly like include(a.php). If means how to call it.Any ideas please tell me.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    not sure what you mean. Yes, you can store the file name in a variable and use that variable like the original name -- if that's what you mean.

    PHP Code:
    $functions_script 'functions.php';
    require_once 
    $functions_script
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0

    Smile


    Thanks Jacques1. You have correctly understood my question. This is the exact one what i'm trying for past few days. Thanks again.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    Please tell me how to declare it in if condition.
    PHP Code:
    for($i=0$i<6;$i++){
    if(
    $var[$i]==$str)
    {
        
    $var1="a.php";
        require_once 
    $var1;  
    }
    else if(
    $var[$i]==$str){
                                   
    $var1="b.php";
                               require_once 
    $var1
                                   }

    It is showing some error while doing like this.
  8. #5
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    What is "some error"? What's the exact error message?

    Apart from that, the code is kind of strange. The condition for "if" and "elseif" are exactly the same, which means the "elseif" will never be executed. And requiring constant files in a loop also makes little sense.

    What are you trying to do?
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    24
    Rep Power
    0
    My error message is Fatal error: Cannot redeclare qurexecute() (previously declared in /opt/lampp/htdocs/admin/a.php:1033) in /opt/lampp/htdocs/admin/b.php on line 1031
    My table having two columns. I stored one column values in a array. Now i'm checking whether what i'm clicking is in the array or not. If it is seen in array it should open the corresponding php file.Like this i'm trying to do.

IMN logo majestic logo threadwatch logo seochat tools logo