RE: [PHP] which one is faster
From: Steve Staples > On Tue, 2010-10-05 at 20:53 +0100, Ashley Sheridan wrote: >> On Tue, 2010-10-05 at 15:46 -0400, Steve Staples wrote: >> >> > On Tue, 2010-10-05 at 20:35 +0100, Ashley Sheridan wrote: >> > > On Tue, 2010-10-05 at 15:28 -0400, chris h wrote: >> > > >> > > > Benchmark and find out! :) >> > > > >> > > > What are you using this for? Unless you are doing something crazy it >> > > > probably doesn't matter, and you should pick whichever you feel looks nicer >> > > > / is easier to code in / etc. >> > > > >> > > > Chris H. >> > > > >> > > > On Tue, Oct 5, 2010 at 3:23 PM, saeed ahmed wrote: >> > > > >> > > > > $a = 'hey'; >> > > > > $b = 'done'; >> > > > > >> > > > > $c = $a.$b; >> > > > > $c = "$a$b"; >> > > > > >> > > > > which one is faster for echo $c. >> > > > > >> > > >> > > >> > > As far as I'm aware, the first of the two will be faster, but only just. >> > > As Saeed mentioned, the difference will be negligible, and unless you >> > > plan to run a line like that in a loop or something hundreds of >> > > thousands of times, you probably won't notice any difference. >> > > Thanks, >> > > Ash >> > > http://www.ashleysheridan.co.uk >> > >> > to be proper, shouldn't it technically be >> > $c = "{$a}{$b}"; >> > >> >> It doesn't have to use the braces. The braces only tell PHP exactly >> where to stop parsing the current variable name. The following examples >> wouldn't work without them: >> >> $var = 'hello '; >> $arr = array('msg 1'=>'hello','msg 2'=>'world'); >> >> echo "{$var}world"; >> echo "{$arr['msg 1']}{$arr['msg 2']}"; >> >> Without the braces, in the first example PHP would look for a variable >> called $varworld, and in the second it would be looking for a simple >> scaler called $arr, not the array value you wanted. >> > Ash: > > I understand what the {} does, but just like in HTML, it is more proper > to use lower case for the attributes/elements, and use " (double quotes) > when wrapping the attributes... but is it not "REQUIRED" to write it in > that manner... just like it is not required to wrap the variables in {} > when inside the ""... > > that's just me, I tend to try and do that every time... XHTML requires both lower case and double quotes. So if that may be in your future, you should be using both already. I don't know about HTML 5. Since that spec is still years away from completion and hasn't added anything we can make use of, we haven't even bothered to look at it. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On 6 October 2010 14:40, Bob McConnell wrote: > From: Steve Staples > >> On Tue, 2010-10-05 at 20:53 +0100, Ashley Sheridan wrote: >>> On Tue, 2010-10-05 at 15:46 -0400, Steve Staples wrote: >>> >>> > On Tue, 2010-10-05 at 20:35 +0100, Ashley Sheridan wrote: >>> > > On Tue, 2010-10-05 at 15:28 -0400, chris h wrote: >>> > > >>> > > > Benchmark and find out! :) >>> > > > >>> > > > What are you using this for? Unless you are doing something > crazy it >>> > > > probably doesn't matter, and you should pick whichever you feel > looks nicer >>> > > > / is easier to code in / etc. >>> > > > >>> > > > Chris H. >>> > > > >>> > > > On Tue, Oct 5, 2010 at 3:23 PM, saeed ahmed > wrote: >>> > > > >>> > > > > $a = 'hey'; >>> > > > > $b = 'done'; >>> > > > > >>> > > > > $c = $a.$b; >>> > > > > $c = "$a$b"; >>> > > > > >>> > > > > which one is faster for echo $c. >>> > > > > >>> > > >>> > > >>> > > As far as I'm aware, the first of the two will be faster, but > only just. >>> > > As Saeed mentioned, the difference will be negligible, and unless > you >>> > > plan to run a line like that in a loop or something hundreds of >>> > > thousands of times, you probably won't notice any difference. >>> > > Thanks, >>> > > Ash >>> > > http://www.ashleysheridan.co.uk >>> > >>> > to be proper, shouldn't it technically be >>> > $c = "{$a}{$b}"; >>> > >>> >>> It doesn't have to use the braces. The braces only tell PHP exactly >>> where to stop parsing the current variable name. The following > examples >>> wouldn't work without them: >>> >>> $var = 'hello '; >>> $arr = array('msg 1'=>'hello','msg 2'=>'world'); >>> >>> echo "{$var}world"; >>> echo "{$arr['msg 1']}{$arr['msg 2']}"; >>> >>> Without the braces, in the first example PHP would look for a > variable >>> called $varworld, and in the second it would be looking for a simple >>> scaler called $arr, not the array value you wanted. >>> >> Ash: >> >> I understand what the {} does, but just like in HTML, it is more > proper >> to use lower case for the attributes/elements, and use " (double > quotes) >> when wrapping the attributes... but is it not "REQUIRED" to write it > in >> that manner... just like it is not required to wrap the variables in > {} >> when inside the ""... >> >> that's just me, I tend to try and do that every time... > > XHTML requires both lower case and double quotes. So if that may be in > your future, you should be using both already. > > I don't know about HTML 5. Since that spec is still years away from > completion and hasn't added anything we can make use of, we haven't even > bothered to look at it. > Where exactly do you get the part about double quotes from? Can't seem to locate it in the any of the relevant specs (xhtml or xml). Also, never seen an xml or xhtml validator choke on single quotes. As for html 5, it's in use today already. Big parts of it are unlikely to change, so there's little reason not to start using it. Regards Peter -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On 10-10-06 08:52 AM, Peter Lind wrote: Where exactly do you get the part about double quotes from? Can't seem to locate it in the any of the relevant specs (xhtml or xml). Also, never seen an xml or xhtml validator choke on single quotes. http://www.w3.org/TR/xhtml1/#h-4.2 Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On 10-10-06 09:06 AM, Peter Lind wrote: On 6 October 2010 15:03, Robert Cummings wrote: On 10-10-06 08:52 AM, Peter Lind wrote: Where exactly do you get the part about double quotes from? Can't seem to locate it in the any of the relevant specs (xhtml or xml). Also, never seen an xml or xhtml validator choke on single quotes. http://www.w3.org/TR/xhtml1/#h-4.2 I quote: "4.2. Element and attribute names must be in lower case. XHTML documents must use lower case for all HTML element and attribute names. This difference is necessary because XML is case-sensitive e.g. and are different tags." Where in that do you see anything about double quotes? Maybe you're thinking of http://www.w3.org/TR/xhtml1/#h-4.4 - but that just states quoted, nothing about double quotes vs. single quotes. Nope, sorry, I had lowercase on the brain. In XHTML you can use single or double quotes :) *gulps down more coffee* Cheers, Rob. -- E-Mail Disclaimer: Information contained in this message and any attached documents is considered confidential and legally protected. This message is intended solely for the addressee(s). Disclosure, copying, and distribution are prohibited unless authorized. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On Wed, Oct 6, 2010 at 9:03 AM, Robert Cummings wrote: > On 10-10-06 08:52 AM, Peter Lind wrote: >> >> Where exactly do you get the part about double quotes from? Can't seem >> to locate it in the any of the relevant specs (xhtml or xml). Also, >> never seen an xml or xhtml validator choke on single quotes. > > http://www.w3.org/TR/xhtml1/#h-4.2 > > Cheers, > Rob. I don't see that it explicitly states a requirement for double quotes there -- it certainly implies it, but the text never says anything about either double-quotes being required or single-quotes being disallowed. Full text: "All attribute values must be quoted, even those which appear to be numeric." Is there a statement somewhere in the document that says quotes are always double-quotes? -Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On Wed, Oct 6, 2010 at 9:25 AM, Peter Lind wrote: > On 6 October 2010 15:21, Andy McKenzie wrote: >> On Wed, Oct 6, 2010 at 9:03 AM, Robert Cummings wrote: >>> On 10-10-06 08:52 AM, Peter Lind wrote: Where exactly do you get the part about double quotes from? Can't seem to locate it in the any of the relevant specs (xhtml or xml). Also, never seen an xml or xhtml validator choke on single quotes. >>> >>> http://www.w3.org/TR/xhtml1/#h-4.2 >>> >>> Cheers, >>> Rob. >> >> I don't see that it explicitly states a requirement for double quotes >> there -- it certainly implies it, but the text never says anything >> about either double-quotes being required or single-quotes being >> disallowed. >> >> Full text: Â "All attribute values must be quoted, even those which >> appear to be numeric." >> >> Is there a statement somewhere in the document that says quotes are >> always double-quotes? > > No, there isn't. Both single quotes and double quotes are allowed for > attributes in both XML and XHTML. What makes you think it's implied > that double quotes are the only allowed form of quotes? > > Regards > Peter > Double quotes are the only example given: in most documentation if there are two allowed forms, there are two examples, or at least a note in the text. I haven't read enough of this particular document to know if they follow that form, but I've certainly seen it a lot of places. -Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On 6 October 2010 15:31, Andy McKenzie wrote: *snip* > Double quotes are the only example given: Â in most documentation if > there are two allowed forms, there are two examples, or at least a > note in the text. Â I haven't read enough of this particular document > to know if they follow that form, but I've certainly seen it a lot of > places. > > -Alex > Xhtml documents are xml documents and thus must follow the specs for XML. Specifically, the following: http://www.w3.org/TR/2008/REC-xml-20081126/#NT-AttValue Regards Peter -- WWW: plphp.dk / plind.dk LinkedIn: plind BeWelcome/Couchsurfing: Fake51 Twitter: kafe15 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] which one is faster
On Wed, 2010-10-06 at 15:43 +0200, Peter Lind wrote: > On 6 October 2010 15:31, Andy McKenzie wrote: > > *snip* > > > Double quotes are the only example given: in most documentation if > > there are two allowed forms, there are two examples, or at least a > > note in the text. I haven't read enough of this particular document > > to know if they follow that form, but I've certainly seen it a lot of > > places. > > > > -Alex > > > > Xhtml documents are xml documents and thus must follow the specs for > XML. Specifically, the following: > http://www.w3.org/TR/2008/REC-xml-20081126/#NT-AttValue > > Regards > Peter Wow... I didn't mean to spark up a debate/battle about the use of " vs ' or anything... I was just under the impression that the use of {} when referring to a variable inside the "" was "proper", and was the way it "should" be done, not that it "HAD" to be done that way... even back in 92 when I started HTML programming, I was taught that elements and attributes should be in lower case, attributes should be within ""... and when i started using PHP, I would always use "" and when referencing a variable, "text ". $var ." more text" was the way I did it, and then i read somewhere that variable inside "" to avoid any potential issues, should be enclosed with {}. Granted, it works without using them (for 99% of things), but as my personal preference, that is the way i do it, and was under the impression that it should be used in that manner, to avoid deprecation. Now, to end my run on and on and on sentence... it was just something I have always done, just like the code formatting i follow (which i wont get into, cuz that will prolly start another huge long thread too :P) -- As for the OP's question, I don't think it really matters which one you use, it would boil down to which one makes more sense to you when you read it later and try to figure out why you did it the way you did :) (documentation is essential for deciphering code the next day) If you're worried about I/O processes, and have to constrain yourself to using 1 or 2 more I/O processes, then you should do a lot of benchmarking to determine for yourself which is more efficient on your hardware. again, just my $0.02. Steve. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Casting from parent class to child
Hi, I'm trying to extends the base class DateTime. parent::createFromFormat("H.i d.m.Y", $string); returns a DateTime and I want to convert it into a DateTimePlus (my own extended class). What's the best way to do this plz ? Some code: class DateTimePlus extends DateTime { static function setFromGUIDateAndTime($date,$time ){ $string = $time.' '.$date; //echo 'str:'.$string; $res = parent::createFromFormat("H.i d.m.Y", $string); return (DateTimePlus)parent::createFromFormat("H.i d.m.Y", $string); } Thk you matt
[PHP] PHP Unconference Europe
I'm not affiliated with the PHP Unconference in any way but saw this on another mailing list, so just passing it on here in case anyone is interested. -Tom We are delighted to announce that PHP Unconference Europe will take place on: 19th & 20th February 2011 in: Manchester, UK. The venue will be in a central location, very accessible from all three train stations in Manchester city center. Learn more at: http://www.phpuceu.org/2010/10/03/save-the-date-feb-19-20-2011/ As PHP Unconference Europe is an international event, admission tickets will go on sale in two currencies. They will cost £ 40.00 or € 46.00. We expect to announce the exact venue and put the entry tickets up for sale very shortly. PHP Unconference Europe is organized by group of volunteers, based throughout Europe and is non-commercial. The goal of the unconference is the exchange of information about PHP and related topics, not to make a profit - ticket sales and sponsor funding just cover our costs. We really need your help in spreading the word and to make the unconference a success. Here is how you can help: 1. If you have a blog about PHP or related web technologies, please post a short message, announcing PHP Unconference Europe. 2. Tweet about the unconference. The official hash tag is #phpuceu . 3. Tell all your friends and colleagues, who are interested in PHP and related web technologies about the unconference. The organizers look forward to seeing many of you at the event.
Re: [PHP] Casting from parent class to child
Casting does not change an object. You must copy the relevant value(s) from the object returned into a new DateTimePlus. Since DateTime's constructor takes only a string, and I assume it won't accept your format directly, you're better off converting the string into a Unix timestamp and creating a new object from that. However, I leave that optimization to you. The following code is sufficient: $plus = new DateTimePlus(); $plus.setTimestamp(parent::createFromFormat("H.i d.m.Y", $string).getTimestamp()); return $plus; David
[PHP] Class mysqli not found
I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed?
Re: [PHP] Class mysqli not found
On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: > I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. > I can access MySql via the prompt. Apache and PHP are installed and > working. In Apache's config file PHPIniDir is set to "C:\php", which is > where I unzipped the binary download files, and set LoadModule php5_module > C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and > mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited > the environment variables to include C:\php and C:php\ext. > > I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and > MySql Server 5.1. > > What have I missed? How are you connecting to the mysql? What does your connection string look like from your php file? Can you cut and paste it here for us to trouble shoot (if it is the apache->php->mysql connection problem) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class mysqli not found
Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed? How are you connecting to the mysql? What does your connection string look like from your php file? Can you cut and paste it here for us to trouble shoot (if it is the apache->php->mysql connection problem) Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class mysqli not found
[snip] When I run this small program I get a Fatal Error: Class mysqli not found error message. [/snip] Have you run a simple phpinfo(); to see if you have the mysqli module? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Class mysqli not found
Sueandant : mysqli is set of functions not a class. The name to connect is mysqli_connect /** * * * @version $Id$ * @copyright 2010 */ $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on top of php db functions. Alejandro M.S. -Mensagem original- De: sueandant [mailto:hollandsath...@tiscali.co.uk] Enviada em: quarta-feira, 6 de outubro de 2010 17:27 Para: sstap...@mnsi.net Cc: PHP Assunto: Re: [PHP] Class mysqli not found Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found > On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: >> I'm still fighting a losing battle in my attempts to get PHP speak to >> mysqli. I can access MySql via the prompt. Apache and PHP are installed >> and working. In Apache's config file PHPIniDir is set to "C:\php", >> which is where I unzipped the binary download files, and set LoadModule >> php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the >> mysql.dll and mysqli.dll extensions and set extension_dir = >> "C:\php\ext\". I have edited the environment variables to include >> C:\php and C:php\ext. >> >> I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 >> and MySql Server 5.1. >> >> What have I missed? > > How are you connecting to the mysql? What does your connection string > look like from your php file? Can you cut and paste it here for us to > trouble shoot (if it is the apache->php->mysql connection problem) > > > Steve > -- 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
RES: [PHP] Class mysqli not found
Sorry, but it is a class... C:\php\ext folder has the php_mysql.dll and php_mysqli.dll ? Alejandro M.S. -Mensagem original- De: Alejandro Michelin Salomon [mailto:amichel...@hotmail.com] Enviada em: quarta-feira, 6 de outubro de 2010 17:34 Para: 'sueandant' Cc: 'php-general@lists.php.net' Assunto: RES: [PHP] Class mysqli not found Sueandant : mysqli is set of functions not a class. The name to connect is mysqli_connect /** * * * @version $Id$ * @copyright 2010 */ $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on top of php db functions. Alejandro M.S. -Mensagem original- De: sueandant [mailto:hollandsath...@tiscali.co.uk] Enviada em: quarta-feira, 6 de outubro de 2010 17:27 Para: sstap...@mnsi.net Cc: PHP Assunto: Re: [PHP] Class mysqli not found Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found > On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: >> I'm still fighting a losing battle in my attempts to get PHP speak to >> mysqli. I can access MySql via the prompt. Apache and PHP are installed >> and working. In Apache's config file PHPIniDir is set to "C:\php", >> which is where I unzipped the binary download files, and set LoadModule >> php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the >> mysql.dll and mysqli.dll extensions and set extension_dir = >> "C:\php\ext\". I have edited the environment variables to include >> C:\php and C:php\ext. >> >> I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 >> and MySql Server 5.1. >> >> What have I missed? > > How are you connecting to the mysql? What does your connection string > look like from your php file? Can you cut and paste it here for us to > trouble shoot (if it is the apache->php->mysql connection problem) > > > Steve > -- 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
Re: RES: [PHP] Class mysqli not found
http://php.net/manual/en/class.mysqli.php definitely says MySQLi is a class. It looks like PHP was complied without MySQLi support. Does running a phpinfo() show the MySQLi module? On 7/10/2010, at 9:33 AM, Alejandro Michelin Salomon wrote: > Sueandant : > > mysqli is set of functions not a class. The name to connect is mysqli_connect > /** > * > * > * @version $Id$ > * @copyright 2010 > */ > $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); > > if (mysqli_connect_errno()) { > printf("Connect failed: %s\n", mysqli_connect_error()); > exit(); > } else { > printf("Host information: %s\n", mysqli_get_host_info($mysqli)); > } > > > Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on > top of php db functions. > > Alejandro M.S. > > -Mensagem original- > De: sueandant [mailto:hollandsath...@tiscali.co.uk] > Enviada em: quarta-feira, 6 de outubro de 2010 17:27 > Para: sstap...@mnsi.net > Cc: PHP > Assunto: Re: [PHP] Class mysqli not found > > Thanks Steve. Here's the php file: > > > /** > * > * > * @version $Id$ > * @copyright 2010 > */ > $mysqli = new mysqli("localhost", "root", "woodcote", "testDB"); > > if (mysqli_connect_errno()) { > printf("Connect failed: %s\n", mysqli_connect_error()); > exit(); > } else { > printf("Host information: %s\n", mysqli_get_host_info($mysqli)); > } > > ?> > > When I run this small program I get a Fatal Error: Class mysqli not found > error message. > > > - Original Message - > From: "Steve Staples" > To: "sueandant" > Cc: "PHP" > Sent: Wednesday, October 06, 2010 9:09 PM > Subject: Re: [PHP] Class mysqli not found > > >> On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: >>> I'm still fighting a losing battle in my attempts to get PHP speak to >>> mysqli. I can access MySql via the prompt. Apache and PHP are installed >>> and working. In Apache's config file PHPIniDir is set to "C:\php", >>> which is where I unzipped the binary download files, and set LoadModule >>> php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the >>> mysql.dll and mysqli.dll extensions and set extension_dir = >>> "C:\php\ext\". I have edited the environment variables to include >>> C:\php and C:php\ext. >>> >>> I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 >>> and MySql Server 5.1. >>> >>> What have I missed? >> >> How are you connecting to the mysql? What does your connection string >> look like from your php file? Can you cut and paste it here for us to >> trouble shoot (if it is the apache->php->mysql connection problem) >> >> >> Steve >> > > > -- > 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 > --- Simon Welsh Admin of http://simon.geek.nz/ Who said Microsoft never created a bug-free program? The blue screen never, ever crashes! http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class mysqli not found
mysqli is set of functions not a class. The name to connect is mysqli_connect mysqli can be used as either a set of functions ( mysqli_connect(..) ) OR it can be used an an object ( new mysqli(...) ). When used as an object you just use the various functions as methods. http://www.php.net/manual/en/mysqli.connect.php Chris. On Wed, Oct 6, 2010 at 4:33 PM, Alejandro Michelin Salomon < amichel...@hotmail.com> wrote: > Sueandant : > > mysqli is set of functions not a class. The name to connect is > mysqli_connect > /** > * > * > * @version $Id$ > * @copyright 2010 > */ > $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); > > if (mysqli_connect_errno()) { > printf("Connect failed: %s\n", mysqli_connect_error()); > exit(); > } else { > printf("Host information: %s\n", mysqli_get_host_info($mysqli)); > } > > > Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on > top of php db functions. > > Alejandro M.S. > > -Mensagem original- > De: sueandant [mailto:hollandsath...@tiscali.co.uk] > Enviada em: quarta-feira, 6 de outubro de 2010 17:27 > Para: sstap...@mnsi.net > Cc: PHP > Assunto: Re: [PHP] Class mysqli not found > > Thanks Steve. Here's the php file: > > > /** > * > * > * @version $Id$ > * @copyright 2010 > */ > $mysqli = new mysqli("localhost", "root", "woodcote", "testDB"); > > if (mysqli_connect_errno()) { > printf("Connect failed: %s\n", mysqli_connect_error()); > exit(); > } else { > printf("Host information: %s\n", mysqli_get_host_info($mysqli)); > } > > ?> > > When I run this small program I get a Fatal Error: Class mysqli not found > error message. > > > - Original Message - > From: "Steve Staples" > To: "sueandant" > Cc: "PHP" > Sent: Wednesday, October 06, 2010 9:09 PM > Subject: Re: [PHP] Class mysqli not found > > > > On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: > >> I'm still fighting a losing battle in my attempts to get PHP speak to > >> mysqli. I can access MySql via the prompt. Apache and PHP are > installed > >> and working. In Apache's config file PHPIniDir is set to "C:\php", > >> which is where I unzipped the binary download files, and set LoadModule > >> php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented > the > >> mysql.dll and mysqli.dll extensions and set extension_dir = > >> "C:\php\ext\". I have edited the environment variables to include > >> C:\php and C:php\ext. > >> > >> I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 > >> and MySql Server 5.1. > >> > >> What have I missed? > > > > How are you connecting to the mysql? What does your connection string > > look like from your php file? Can you cut and paste it here for us to > > trouble shoot (if it is the apache->php->mysql connection problem) > > > > > > Steve > > > > > -- > 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 > >
Re: [PHP] Class mysqli not found
Yes, I've run phpinfo() and mysqli is listed in the detailed output. - Original Message - From: "Jay Blanchard" To: "sueandant" ; Cc: "PHP" Sent: Wednesday, October 06, 2010 9:31 PM Subject: RE: [PHP] Class mysqli not found [snip] When I run this small program I get a Fatal Error: Class mysqli not found error message. [/snip] Have you run a simple phpinfo(); to see if you have the mysqli module? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Class mysqli not found
I've tried this and get the same error message. - Original Message - From: "Alejandro Michelin Salomon" To: "'sueandant'" Cc: Sent: Wednesday, October 06, 2010 9:33 PM Subject: RES: [PHP] Class mysqli not found Sueandant : mysqli is set of functions not a class. The name to connect is mysqli_connect /** * * * @version $Id$ * @copyright 2010 */ $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on top of php db functions. Alejandro M.S. -Mensagem original- De: sueandant [mailto:hollandsath...@tiscali.co.uk] Enviada em: quarta-feira, 6 de outubro de 2010 17:27 Para: sstap...@mnsi.net Cc: PHP Assunto: Re: [PHP] Class mysqli not found Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed? How are you connecting to the mysql? What does your connection string look like from your php file? Can you cut and paste it here for us to trouble shoot (if it is the apache->php->mysql connection problem) Steve -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Class mysqli not found
phpinfo() includes mysqli in its detailed output: mysqli MysqlI Support enabled Client API library version mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off - Original Message - From: "Simon J Welsh" To: "Alejandro Michelin Salomon" Cc: "'sueandant'" ; Sent: Wednesday, October 06, 2010 9:43 PM Subject: Re: RES: [PHP] Class mysqli not found http://php.net/manual/en/class.mysqli.php definitely says MySQLi is a class. It looks like PHP was complied without MySQLi support. Does running a phpinfo() show the MySQLi module? On 7/10/2010, at 9:33 AM, Alejandro Michelin Salomon wrote: Sueandant : mysqli is set of functions not a class. The name to connect is mysqli_connect /** * * * @version $Id$ * @copyright 2010 */ $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on top of php db functions. Alejandro M.S. -Mensagem original- De: sueandant [mailto:hollandsath...@tiscali.co.uk] Enviada em: quarta-feira, 6 de outubro de 2010 17:27 Para: sstap...@mnsi.net Cc: PHP Assunto: Re: [PHP] Class mysqli not found Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed? How are you connecting to the mysql? What does your connection string look like from your php file? Can you cut and paste it here for us to trouble shoot (if it is the apache->php->mysql connection problem) Steve -- 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 --- Simon Welsh Admin of http://simon.geek.nz/ Who said Microsoft never created a bug-free program? The blue screen never, ever crashes! http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e -- 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
Re: RES: [PHP] Class mysqli not found
Are you doing phpinfo() off the CLI or via apache mod? Is it the same way you are running the actual script that's calling on mysqli? On Wed, Oct 6, 2010 at 4:58 PM, sueandant wrote: > phpinfo() includes mysqli in its detailed output: > > mysqli > MysqlI Support enabled > Client API library version mysqlnd 5.0.7-dev - 091210 - $Revision: > 300533 $ > Active Persistent Links 0 > Inactive Persistent Links 0 > Active Links 0 > > Directive Local Value Master Value > mysqli.allow_local_infile On On > mysqli.allow_persistent On On > mysqli.default_host no value no value > mysqli.default_port 3306 3306 > mysqli.default_pw no value no value > mysqli.default_socket no value no value > mysqli.default_user no value no value > mysqli.max_links Unlimited Unlimited > mysqli.max_persistent Unlimited Unlimited > mysqli.reconnect Off Off > > - Original Message - From: "Simon J Welsh" > To: "Alejandro Michelin Salomon" > Cc: "'sueandant'" ; < > php-general@lists.php.net> > Sent: Wednesday, October 06, 2010 9:43 PM > Subject: Re: RES: [PHP] Class mysqli not found > > > > http://php.net/manual/en/class.mysqli.php definitely says MySQLi is a > class. > > It looks like PHP was complied without MySQLi support. Does running a > phpinfo() show the MySQLi module? > On 7/10/2010, at 9:33 AM, Alejandro Michelin Salomon wrote: > > Sueandant : >> >> mysqli is set of functions not a class. The name to connect is >> mysqli_connect >> /** >> * >> * >> * @version $Id$ >> * @copyright 2010 >> */ >> $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); >> >> if (mysqli_connect_errno()) { >> printf("Connect failed: %s\n", mysqli_connect_error()); >> exit(); >> } else { >> printf("Host information: %s\n", mysqli_get_host_info($mysqli)); >> } >> >> >> Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer >> on top of php db functions. >> >> Alejandro M.S. >> >> -Mensagem original- >> De: sueandant [mailto:hollandsath...@tiscali.co.uk] >> Enviada em: quarta-feira, 6 de outubro de 2010 17:27 >> Para: sstap...@mnsi.net >> Cc: PHP >> Assunto: Re: [PHP] Class mysqli not found >> >> Thanks Steve. Here's the php file: >> >> > >> /** >> * >> * >> * @version $Id$ >> * @copyright 2010 >> */ >> $mysqli = new mysqli("localhost", "root", "woodcote", "testDB"); >> >> if (mysqli_connect_errno()) { >> printf("Connect failed: %s\n", mysqli_connect_error()); >> exit(); >> } else { >> printf("Host information: %s\n", mysqli_get_host_info($mysqli)); >> } >> >> ?> >> >> When I run this small program I get a Fatal Error: Class mysqli not found >> error message. >> >> >> - Original Message - From: "Steve Staples" >> To: "sueandant" >> Cc: "PHP" >> Sent: Wednesday, October 06, 2010 9:09 PM >> Subject: Re: [PHP] Class mysqli not found >> >> >> On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: >>> I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed? >>> >>> How are you connecting to the mysql? What does your connection string >>> look like from your php file? Can you cut and paste it here for us to >>> trouble shoot (if it is the apache->php->mysql connection problem) >>> >>> >>> Steve >>> >>> >> >> -- >> 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 >> >> > --- > Simon Welsh > Admin of http://simon.geek.nz/ > > Who said Microsoft never created a bug-free program? The blue screen never, > ever crashes! > > http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e > > > > > > -- > 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 > >
Re: RES: [PHP] Class mysqli not found
I'm running phpinfo from my browser under localhost. - Original Message - From: chris h To: sueandant Cc: PHP Sent: Wednesday, October 06, 2010 10:12 PM Subject: Re: RES: [PHP] Class mysqli not found Are you doing phpinfo() off the CLI or via apache mod? Is it the same way you are running the actual script that's calling on mysqli? On Wed, Oct 6, 2010 at 4:58 PM, sueandant wrote: phpinfo() includes mysqli in its detailed output: mysqli MysqlI Support enabled Client API library version mysqlnd 5.0.7-dev - 091210 - $Revision: 300533 $ Active Persistent Links 0 Inactive Persistent Links 0 Active Links 0 Directive Local Value Master Value mysqli.allow_local_infile On On mysqli.allow_persistent On On mysqli.default_host no value no value mysqli.default_port 3306 3306 mysqli.default_pw no value no value mysqli.default_socket no value no value mysqli.default_user no value no value mysqli.max_links Unlimited Unlimited mysqli.max_persistent Unlimited Unlimited mysqli.reconnect Off Off - Original Message - From: "Simon J Welsh" To: "Alejandro Michelin Salomon" Cc: "'sueandant'" ; Sent: Wednesday, October 06, 2010 9:43 PM Subject: Re: RES: [PHP] Class mysqli not found http://php.net/manual/en/class.mysqli.php definitely says MySQLi is a class. It looks like PHP was complied without MySQLi support. Does running a phpinfo() show the MySQLi module? On 7/10/2010, at 9:33 AM, Alejandro Michelin Salomon wrote: Sueandant : mysqli is set of functions not a class. The name to connect is mysqli_connect /** * * * @version $Id$ * @copyright 2010 */ $mysqli = mysqli_connect ("localhost", "root", "woodcote", "testDB"); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } else { printf("Host information: %s\n", mysqli_get_host_info($mysqli)); } Try adodb lib for php ( http://adodb.sourceforge.net/ ), is great layer on top of php db functions. Alejandro M.S. -Mensagem original- De: sueandant [mailto:hollandsath...@tiscali.co.uk] Enviada em: quarta-feira, 6 de outubro de 2010 17:27 Para: sstap...@mnsi.net Cc: PHP Assunto: Re: [PHP] Class mysqli not found Thanks Steve. Here's the php file: When I run this small program I get a Fatal Error: Class mysqli not found error message. - Original Message - From: "Steve Staples" To: "sueandant" Cc: "PHP" Sent: Wednesday, October 06, 2010 9:09 PM Subject: Re: [PHP] Class mysqli not found On Wed, 2010-10-06 at 21:00 +0100, sueandant wrote: I'm still fighting a losing battle in my attempts to get PHP speak to mysqli. I can access MySql via the prompt. Apache and PHP are installed and working. In Apache's config file PHPIniDir is set to "C:\php", which is where I unzipped the binary download files, and set LoadModule php5_module C:\php\php5apache2_2.dll. In php.ini I have uncommented the mysql.dll and mysqli.dll extensions and set extension_dir = "C:\php\ext\". I have edited the environment variables to include C:\php and C:php\ext. I am running Vista Home Premium 32 bit with SP2, Apache 2.2, PHP 5.3.3 and MySql Server 5.1. What have I missed? How are you connecting to the mysql? What does your connection string look like from your php file? Can you cut and paste it here for us to trouble shoot (if it is the apache->php->mysql connection problem) Steve -- 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 --- Simon Welsh Admin of http://simon.geek.nz/ Who said Microsoft never created a bug-free program? The blue screen never, ever crashes! http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e -- 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
Re: [PHP] Variable (Class instantiation) collision
Gentlemen, Thank you. The "Thing1 Thing2" approach worked. >If you have total control over application A which contains the bridge >code, the easiest is to change it to use a different global variable. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Class mysqli not found
> -Original Message- > From: chris h [mailto:chris...@gmail.com] > Sent: Wednesday, October 06, 2010 1:44 PM > To: Alejandro Michelin Salomon > Cc: sueandant; php-general@lists.php.net > Subject: Re: [PHP] Class mysqli not found > > mysqli is set of functions not a class. The name to connect is mysqli_connect > > > mysqli can be used as either a set of functions ( mysqli_connect(..) ) OR it > can be used an an object ( new mysqli(...) ). When used as an object you > just use the various functions as methods. > > http://www.php.net/manual/en/mysqli.connect.php > > > Chris. > Correction: mysqli extension can be implemented as either procedural via functions or as class objects via $mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db'); Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] daemon
Hi, Does anyone have a script running as daemon on Linux/Unix (variants) as part of your PHP application? If so, what are you using to schedule the script to run? cron? Thanks, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] daemon
On Wed, Oct 6, 2010 at 11:21 PM, Tommy Pham wrote: > Hi, > > Does anyone have a script running as daemon on Linux/Unix (variants) as > part > of your PHP application? If so, what are you using to schedule the script > to run? cron? > cron is one way to do it for scripts you schedule. for real daemon processes though ive recently deployed a php script on gentoo by leveraging the init scripts. essentially my program runs a while(true) and uses pcntl_fork() to create worker children. the parent process listens for signals which are sent by an init script. theres also a really nice start-stop-daemon function in the init script library which backgrounds the process for me and creates a pid lockfile. really slick. now i have an interface to my script like /etc/init.d/php-service start etc. plus it ties right into the runlevel scripts, i just run rc-update add php-service default and the script will start when the box hits runlevel 3! -nathan
[PHP] Re: Vermis - new issue tracker in PHP
Hello, Actually I'm planning the 1.0 version of Vermis, if you have any suggestions what should be improved and changed please share. I'd very appreciate that kind of feedback. Feel free to download, test and use Vermis. Thanks, Lukasz (cepa) Cepowski DiabloWare :: Software from Hell! www.diabloware.com | www.cepowski.pl skype: lukasz.cepowski cell: +48 502 670 711 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php