Re: setting function variables

From: Date: Thu, 07 Aug 2003 20:36:28 +0000
Subject: Re: setting function variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158735@lists.php.net to get a copy of this message
--- Micah Montoy <montmica@isu.edu> wrote: > Tried this and it returns errors of type: > > Warning: Wrong parameter count for mssql_result() in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 78 > > Warning: mssql_result(): supplied argument is not a valid MS > SQL-result > resource in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 79 > > Warning: Wrong parameter count for mssql_result() in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 78 > > Warning: mssql_result(): supplied argument is not a valid MS > SQL-result > resource in > c:\inetpub\wwwroot\webpage10\example\utilities\dsp_del_images.php > on line 79 > > Lines 78 and 79 read like this: > > $img_numbers = $qryResults("SELECT COUNT(img_id) AS TotalImages This should be $runQuery(), not $qryResults() > FROM images > WHERE category_id = '$row[0]'"); > $img_count = $qryResults($img_numbers,0,"TotalImages") > > The variables are specified as > > $runQuery = 'mssql_query'; > $qryResults = 'mssql_result'; > > Any ideas of why it would be doing this? Everything works fine > when I don't > try to use the variables. > > thanks > > "Cpt John W. Holmes" <holmes072000@charter.net> wrote in message > news:00fa01c35d1e$bfef29f0$a629089b@TBHHCCDR... > > 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... > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com

« previous php.general (#158735) next »