mysql - Determine where function was called from in php -


i trying call method this:

<?php getalluser($catid);?> 

and there select query in getalluser() method:

function getalluser($query) {   $sql = "select * user catid='".$query."'"; } 

in page, call same method , pass user id instead of category id so:

<?php getalluser($userid);?> 

now, how can identify if there category id or user id in $query, can change in condition base on $query.

add parameter, called from.

options should be:

users categories  function getalluser($query, $calledfrom = '') {   if ($calledfrom == 'users') {     $sql = "select * user catid='".$query."'";   }   if ($calledfrom == 'categories') {    // sql fetching categories.   } } 

and call function like:

<?php getalluser($catid, 'users');?> <?php getalluser($catid, 'categories');?> 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -