jeudi 5 janvier 2017

How to check filename in if condition that calls function in php

i'm calling multiple functions from a function...as per my scope i want to call a specific function from parent function as per file that calls that function...

function dispcategories() {
    include ('database/connection.php');

    $select = mysqli_query($con, "SELECT * FROM categories");

    while ($row = mysqli_fetch_assoc($select)) {
        echo "<table class='category-table'>";
        echo "<tr><td class='main-category' colspan='2'>".$row['category_title']."</td></tr>";
        dispsubcategories($row['cat_id']);
        dispsubcategoriesstate($row['cat_id']);
        echo "</table>";
    }
}

From dispcategories i want to call dispsubcategoriesstate() if and only if file updatestate.php calls dispcategories()...if any other file calls dispcategories() than it should not call to dispsubcategoriesstate()... Hope everyone get the question it is possible to check file name threw if condition or not who calls the function

Aucun commentaire:

Enregistrer un commentaire