Re: [PHP] Stupid question

2013-02-27 Thread Sebastian Krebs
2013/2/27 tamouse mailing lists 

> On Tue, Feb 26, 2013 at 4:41 PM, Jim Lucas  wrote:
> > On 02/26/2013 01:27 PM, Curtis Maurand wrote:
> >>
> >> I have the following:
> >>
> >> $dsn = "mysqli://$username:$password@$hostname2/$database";
> >> $options = array(
> >> 'debug' => 3,
> >> 'result_buffering' => false,
> >> );
> >> $dbh =& MDB2::factory($dsn, $options);
> >> if (PEAR::isError($mdb2))
> >> {
> >> die($mdb2->getMessage());
> >> }
> >>
> >>
> >>
> >>
> >> function tallyCart($_u_id,$dbh){
> >> while($row = $result->fetchrow(MDB2_FETCHMODE_ASSOC)) {
> >
> >
> > Talking in code.  The above two lines tell me...
> >
> > $dbh != $result
> >
> > isset($result) === false
> >
> >
> >
> >> $_showCheckOut=1;
> >> $_pdetail=new ProductDetail($row{'product_ID'},
> >> $row{'product_Quantity'}, $_u_id);
> >> $_getSubTotal += $_pdetail->_subTotal;
> >> $_counter++;
> >> }
> >> }
> >>
> >> I'm getting: Call to undefined method MDB2_Error::fetchrow()
> >>
> >> anyone have any ideas? Can I not pass a database handle to a function?
> >>
> >> Thanks,
> >> Curtis
> >>
> >>
> >
> >
> > --
> > Jim Lucas
> >
> > http://www.cmsws.com/
> > http://www.cmsws.com/examples/
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> Well, *I* have a stupid question: is $lhv =& expr the same as $lhv = &expr
> ??
>

Yes :) Because an operator "=&" doesn't exists, thus the lexer will split
them into the tokens "= &", or "= WHITESPACE &" respectively. The parser
again ignores whitespaces.


>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
github.com/KingCrunch


[PHP] Re: Stupid question

2013-02-27 Thread Jim Giner

On 2/26/2013 4:27 PM, Curtis Maurand wrote:

I have the following:

$dsn = "mysqli://$username:$password@$hostname2/$database";
$options = array(
 'debug' => 3,
 'result_buffering' => false,
   );
   $dbh =& MDB2::factory($dsn, $options);
 if (PEAR::isError($mdb2))
 {
 die($mdb2->getMessage());
 }




function tallyCart($_u_id,$dbh){
while($row = $result->fetchrow(MDB2_FETCHMODE_ASSOC)) {
 $_showCheckOut=1;
 $_pdetail=new ProductDetail($row{'product_ID'},
$row{'product_Quantity'}, $_u_id);
  $_getSubTotal += $_pdetail->_subTotal;
  $_counter++;
 }
}

I'm getting:  Call to undefined method MDB2_Error::fetchrow()

anyone have any ideas?  Can I not pass a database handle to a function?

Thanks,
Curtis



This may be that stupid answer, but I see what appears to be two problems.

1 - $result is not declared globally in your function header, so hence 
it's undefined, hence all of its methods are.


2 - you have a couple indices wrapped in curly braces, not parens.  Is 
that some new kind of syntax I'm not aware of?



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Stupid question

2013-02-27 Thread Serge Fonville
Perhaps he could share all relevant code, since at this time we are mostly
guessing.
Declaration/assignment of a lot of variables isn't included in the snippets.

HTH

Kind regards/met vriendelijke groet,

Serge Fonville

http://www.sergefonville.nl

Convince Microsoft!
They need to add TRUNCATE PARTITION in SQL Server
https://connect.microsoft.com/SQLServer/feedback/details/417926/truncate-partition-of-partitioned-table


2013/2/27 Jim Giner 

> On 2/26/2013 4:27 PM, Curtis Maurand wrote:
>
>> I have the following:
>>
>> $dsn = "mysqli://$username:$password@**$hostname2/$database";
>> $options = array(
>>  'debug' => 3,
>>  'result_buffering' => false,
>>);
>>$dbh =& MDB2::factory($dsn, $options);
>>  if (PEAR::isError($mdb2))
>>  {
>>  die($mdb2->getMessage());
>>  }
>>
>>
>>
>>
>> function tallyCart($_u_id,$dbh){
>> while($row = $result->fetchrow(MDB2_**FETCHMODE_ASSOC)) {
>>  $_showCheckOut=1;
>>  $_pdetail=new ProductDetail($row{'product_**ID'},
>> $row{'product_Quantity'}, $_u_id);
>>   $_getSubTotal += $_pdetail->_subTotal;
>>   $_counter++;
>>  }
>> }
>>
>> I'm getting:  Call to undefined method MDB2_Error::fetchrow()
>>
>> anyone have any ideas?  Can I not pass a database handle to a function?
>>
>> Thanks,
>> Curtis
>>
>>
> This may be that stupid answer, but I see what appears to be two problems.
>
> 1 - $result is not declared globally in your function header, so hence
> it's undefined, hence all of its methods are.
>
> 2 - you have a couple indices wrapped in curly braces, not parens.  Is
> that some new kind of syntax I'm not aware of?
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


RE: [PHP] Re: Stupid question

2013-02-27 Thread Ford, Mike
> -Original Message-
> From: Jim Giner [mailto:jim.gi...@albanyhandball.com]
> Sent: 27 February 2013 12:28
> 
> 
> 2 - you have a couple indices wrapped in curly braces, not parens.
> Is
> that some new kind of syntax I'm not aware of?

No, that's some old kind of syntax you have no reason to be aware of :).

Curly braces as an alternative to square brackets have been deprecated for,
oooh, probably several years now...!


Cheers!

Mike

-- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Portland PD507, City Campus, Leeds Metropolitan University,
Portland Way, LEEDS,  LS1 3HE,  United Kingdom 
E: m.f...@leedsmet.ac.uk T: +44 113 812 4730




To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Running several applications involving PHP on virtual private server - optimization possible?

2013-02-27 Thread Gary Lebowitz
I currently have 1 domain on a VPS with 1 instance of Moodle 2.3.2. To
minimize the danger of overtaxing the resources (I share a processor :-(
but have 2GBytes of guaranteed RAM) I was wondering if there were anything
I could do if I wanted to put, say, Wordpress or another domain on the same
server with another instance of Moodle in terms of PHP tuning. For the
moment all is well, but I prefer to avoid problems in future if possible.
Ah yes, my PHP version is 5.3.3.


Re: [PHP] Stupid question

2013-02-27 Thread tamouse mailing lists
On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs  wrote:
> 2013/2/27 tamouse mailing lists 
>> Well, *I* have a stupid question: is $lhv =& expr the same as $lhv = &expr
>> ??
>
> Yes :) Because an operator "=&" doesn't exists, thus the lexer will split
> them into the tokens "= &", or "= WHITESPACE &" respectively. The parser
> again ignores whitespaces.
>

Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Stupid question

2013-02-27 Thread Curtis Maurand

On 2/27/2013 6:32 PM, tamouse mailing lists wrote:

On Wed, Feb 27, 2013 at 2:42 AM, Sebastian Krebs  wrote:

2013/2/27 tamouse mailing lists 

Well, *I* have a stupid question: is $lhv =& expr the same as $lhv = &expr
??

Yes :) Because an operator "=&" doesn't exists, thus the lexer will split
them into the tokens "= &", or "= WHITESPACE &" respectively. The parser
again ignores whitespaces.


Thanks; thought I was seeing something new, and/or going nuts --
apologies for the thread hijack


Well that means the docs on the PEAR MDB2 website are incorrect and 
should be fixed.  Thanks for the lesson.


--Curtis


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php