Re: setting function variables

From: Date: Thu, 07 Aug 2003 20:01:54 +0000
Subject: Re: setting function variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158728@lists.php.net to get a copy of this message
From: "Mark" <mark_weinstock@yahoo.com> > --- Micah Montoy <montmica@isu.edu> wrote: > > I am trying to specify a single php file to contain all the > > variables and I > > just call this file where necessary. What I am running into is > > that I want > > to do this for all the built in functions (i.e. mssql_query) as > > well. I've > > tried numerous attempts but can't get it to operate without wanting > > to run > > the functions or return an error. Something like this: > > > > $runQuery = @mssql_query; > > $qryResults = @mssql_result; > > $getRow = @mssql_fetch_row; > > $getRowNums = @mssql_num_rows; > > Use a database abstraction class (ADODB, Pear, or something from > phpclasses.org). You're trying to assign a variable to a function's > actions, when you can only assign the variable to teh ooutput of the > function. A good suggestion, since this is what your creating, basically. Anyhow, if you really want to do it your way, it'd be like this: $runQuery = 'mssql_query'; $getRow = 'mssql_fetch_row'; Then you'd use them like this: $result = $runQuery("select ... "); while($row = $getRow($result)) { ... } ---John Holmes...

« previous php.general (#158728) next »