[PHP] Re: Stupid question
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
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 jim.gi...@albanyhandball.com 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
-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] Re: Stupid question
Do phpinfo() for that, you will find that information there. /Peter Phpu [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] Hi, If i have a php and mysql website...how many connections support mysql at one time ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question
* Phpu [EMAIL PROTECTED]: If i have a php and mysql website...how many connections support mysql = at one time ? Depends on your mysql setup; you'll have to look at the mysql configuration file (/etc/my.cnf on most *nices). -- Matthew Weier O'Phinney | mailto:[EMAIL PROTECTED] Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question
when you are working with classes and objects in php, and you are coding inside a class, you must use the $this variable to access the members of the class, for example: class test { //Class vars (something like properties) var $a; var $b; var $c; var $sum; //Class function (Constructor) function test() { $this-a = 'value for a'; $this-b = 'value for b'; $this-c = 'value for c'; $this-set(); } //Class function function set() { $sum = $this-a . $this-b . $this-c; } } //end class luis. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question
as Chris W. Parker noticed, there is a little mistake in the example above posted by me, it says: //Class function function set() { $sum = $this-a . $this-b . $this-c; } and it should say: //Class function function set() { $this-sum = $this-a . $this-b . $this-c; } sorry :P luis. Luis Mirabal [EMAIL PROTECTED] escribió en el mensaje news:[EMAIL PROTECTED] when you are working with classes and objects in php, and you are coding inside a class, you must use the $this variable to access the members of the class, for example: class test { //Class vars (something like properties) var $a; var $b; var $c; var $sum; //Class function (Constructor) function test() { $this-a = 'value for a'; $this-b = 'value for b'; $this-c = 'value for c'; $this-set(); } //Class function function set() { $sum = $this-a . $this-b . $this-c; } } //end class luis. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Stupid question
Luis Mirabal mailto:[EMAIL PROTECTED] on Wednesday, March 17, 2004 3:18 PM said: as Chris W. Parker noticed, there is a little mistake in the example above posted by me, it says: i'd like to thank the academy, my parents, God, my cat, and all of those that voted for me! thank you! kisses :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question, sorry...
All single quotes around variables or escape characters are written out man! it's as simple as that. example you have a variable named $hey and you want to output $hey, you can't it's gonna replace the content of that string with the value of $hey. When you put stuff inside ' ' they are not escaped by the system Mathiue Dumoulin Chris Boget [EMAIL PROTECTED] a écrit dans le message de news: 021901c2cdf4$4a806d00$[EMAIL PROTECTED] Why is it that \n gets translated to a _new line_ when in double quotes whereas it's displayed as the literal when in single quotes? I checked out the docs but couldn't come up with a definitive answer. If someone could point me to the right page in the docs that explains this, I'd be ever so appreciative! thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question, sorry...
Chris Boget schrieb: Why is it that \n gets translated to a _new line_ when in double quotes whereas it's displayed as the literal when in single quotes? I checked out the docs but couldn't come up with a definitive answer. If someone could point me to the right page in the docs that explains this, I'd be ever so appreciative! thnx, Chris all inside of will be interpreted instead of things between '' will be as is ... and as \n means New Line it will do this. If you wish to print out a \n then you have to write it like \\n. This is true for all special characters like: \n - new line \r - carriage return \t - tab \- escape sign for the special characters \\ - backslash itself -- @ Goetz Lohmann, Germany | Web-Developer Sys-Admin \/ -- () He's the fellow that people wonder what he does and || why the company needs him, until he goes on vacation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupid question
I never saw that is it really working? it is supposed to be $_GLOBAL['lala'] too.. but.. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Alex Shi [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have almost two years of experience in PHP. so don't think qualified for being a newbie...However still found something don't know when reading other's code :( Here is what I want to know: $Global{'hello'}. What this means? Is it a Variable-variable? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupid question
I checked the code again...it is $Globals{'lala'}... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I never saw that is it really working? it is supposed to be $_GLOBAL['lala'] too.. but.. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Alex Shi [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have almost two years of experience in PHP. so don't think qualified for being a newbie...However still found something don't know when reading other's code :( Here is what I want to know: $Global{'hello'}. What this means? Is it a Variable-variable? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupid question
It looks like that some yrs ago, the variable $GLOBALS contains all the variable of the page so thats like describing the variable of the page. I'm not sure too, I've never tested/used it. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - H¨¦bergement de sites Internet Alex Shi [EMAIL PROTECTED] a ¨¦crit dans le message de news: [EMAIL PROTECTED] I checked the code again...it is $Globals{'lala'}... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I never saw that is it really working? it is supposed to be $_GLOBAL['lala'] too.. but.. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Alex Shi [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have almost two years of experience in PHP. so don't think qualified for being a newbie...However still found something don't know when reading other's code :( Here is what I want to know: $Global{'hello'}. What this means? Is it a Variable-variable? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Re: stupid question
Try it on your own.. $ary = array('key' = 'val'); $ary['key']; //prints val $ary{'key'}; //prints val Square brackets are more common but both are valid array syntax. There may be special cases where curly braces are used in place of square brackets.. this I don't know. Kevin - Original Message - From: Alex Shi [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 06, 2002 1:28 PM Subject: [PHP] Re: stupid question I checked the code again...it is $Globals{'lala'}... [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I never saw that is it really working? it is supposed to be $_GLOBAL['lala'] too.. but.. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Alex Shi [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have almost two years of experience in PHP. so don't think qualified for being a newbie...However still found something don't know when reading other's code :( Here is what I want to know: $Global{'hello'}. What this means? Is it a Variable-variable? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupid question
Correction: /* Get the first character of a string */ $str = 'This is a test.'; $first = $str{0}; $first will be 'T' -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Alex Shi [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] I have almost two years of experience in PHP. so don't think qualified for being a newbie...However still found something don't know when reading other's code :( Here is what I want to know: $Global{'hello'}. What this means? Is it a Variable-variable? Alex -- --- TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stupid question
Liam, when you want to post a new message to the list don't just hit the reply button and change the subject. If you do that you message appears in the thread of the message you replied to. It really messes things up for people who follow message threads. And worse you might not get any answers to your question since your question has nothing to do with the thread your posting now becomes part of. To answer you question though: I don't know of any short-hand for what you want to do. But this should work. if ( ($idx != 1) ($idx == 4) ($idx == 9) ) { echo$results; } You could also look into using a regexp. Jc Liam Mackenzie wrote: Ok, I'm having a blonde day... If $idx == 1, 4 or 9 I don't want it to echo $results. I have this, what's the syntax to put multiple values in there? if ($idx != 1) { echo$results; } Thanks, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: stupid question
Ok, point taken. Sorry, I didn't know. Also, thanks for the help, I got it :-) - Original Message - From: Jean-Christian Imbeault [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 15, 2002 1:52 PM Subject: [PHP] Re: stupid question Liam, when you want to post a new message to the list don't just hit the reply button and change the subject. If you do that you message appears in the thread of the message you replied to. It really messes things up for people who follow message threads. And worse you might not get any answers to your question since your question has nothing to do with the thread your posting now becomes part of. To answer you question though: I don't know of any short-hand for what you want to do. But this should work. if ( ($idx != 1) ($idx == 4) ($idx == 9) ) { echo$results; } You could also look into using a regexp. Jc Liam Mackenzie wrote: Ok, I'm having a blonde day... If $idx == 1, 4 or 9 I don't want it to echo $results. I have this, what's the syntax to put multiple values in there? if ($idx != 1) { echo$results; } Thanks, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stupid question
[EMAIL PROTECTED] (Liam Mackenzie) wrote: I have a script that outputs this: 0.023884057998657 What's the command to make it shrink down to this: 0.023 round() -- Henrik Hansen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php