php-general Digest 27 Apr 2009 05:25:43 -0000 Issue 6089
php-general Digest 27 Apr 2009 05:25:43 - Issue 6089 Topics (messages 291996 through 292007): Re: Change color of anything in double/single quotes 291996 by: Ashley Sheridan 291997 by: Robert Cummings 291998 by: tedd 291999 by: Sudheer Satyanarayana 292000 by: Robert Cummings Re: inexplicable behaviour SOLVED 292001 by: PJ Re: inexplicable behaviour 292002 by: PJ 292004 by: PJ 292006 by: PJ Re: Formating Numbers 292003 by: Gary Re: MySQL -- finding whether there's a transaction started 292005 by: Chris CamelCase conversion to proper_c_style 292007 by: Paul M Foster Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- On Sun, 2009-04-26 at 11:40 -0400, tedd wrote: At 9:47 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: span class=red?php echo('hello'); ?/span?php echo(' there'); ? I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) I fully understand, but I also see two side to this. On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class=warning and that way the client may say I don't want it red now, but orange and it will be easy enough to change. On the other side, some attributes may be exactly what they claim, such as class=center or class=red. There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic. So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes. Additional consideration, one can combine exact attributes, such as class=center red and it both works and is obvious. I often have in my css, rules such as: .center { text-align: center; } .red { color: red; } While it might not fit with the purest css, it works for me. YMMV. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I think with semantic CSS names, it's more about why the text has to be red, than what colour it is. So if it's red because it is a warning, alert, etc, then it can sometimes be better to give it a name that reflects that. This is mostly down to preference though really. I say mostly, because some UA's might use the class names to derive microformat information, such as dates, author names, etc. Ash www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- On Sun, 2009-04-26 at 11:40 -0400, tedd wrote: At 9:47 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: span class=red?php echo('hello'); ?/span?php echo(' there'); ? I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) I fully understand, but I also see two side to this. On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class=warning and that way the client may say I don't want it red now, but orange and it will be easy enough to change. On the other side, some attributes may be exactly what they claim, such as class=center or class=red. There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic. So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes. Additional
Re: [PHP] How can I detect an exception without using try/catch?
a POSSIBLE work round. see if u can use http://in2.php.net/manual/en/function.error-get-last.php or http://in2.php.net/manual/en/reserved.variables.phperrormsg.php but they are not working as expected with xdebug. use them in the __destruct function to check for an uncaught exception alternatively.. this approach is NOT RECOMMENDED. use it only if u run out of options keep the destructor empty. catch the exception and call a function to perform destruction and then unset the object. at the end of script, check if the object is set, call the function to perform destruction. (php dosent destroy the object if the exception is caught) Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with scandir()
Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 this is the script: ?php $dir = R:\\;//Some Windows Network Drive (Novell Netware Volumen or a Windows Shared Folder) $files1 = scandir($dir); print_r($files1); ? i' m logged to novell as an administrator (testing only) if i use scandir() in a local drive it works fine for example: scandir(D:\\) i have appache server 2.0 installed on a WXP SP3 workstation (only for testing) and a Novell Netware Server v5.0 used as a File Server, PHP 5.0.2 did i say something wrong in the previus post that nobody answer it? This is the first time i have access to a mailing list and maybe i don't know how to ask right? Saludos, Dedel. --- Red Telematica de Salud - Cuba CNICM - Infomed
Re: RES: [PHP] inexplicable behaviour
I have pagination set up and the number for pages next has a link but the next does not. I have experimented with all sorts of configurations of the code but the only thing that works (and this is totally off the wall) is to do this *$Count* = *mysql_num_rows($results);* $Count1=*$Count++;* // without this, the next does not do the link--- but there is no other $Count1 in the code either in the original page or the include page. the script should work even if u replace $Count1 = $Count++; with $Count++; There's a NICE video tutorial available on pagination over the internet. You should watch it. You are counting the number of rows of a result. And you are asking to increase the count by 1. :D Thats not realistic. pagination is done with the help of mySQL's * LIMIT recNUMBER, count* * Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD *Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com
Re: [PHP] Change color of anything in double/single quotes
That's what I was just about saying, in addition try to add the HTML entities to the regular expression as well: $string = preg_replace('/(?: #34;|)(.*?)(?: #34;|)/', 'font color=color\\1/font', $string); Also if you don't to get caught by the HTML validator you better surround the color name with double quotes ;) HTH, Nitsan On Sat, Apr 25, 2009 at 9:42 PM, Daniel Brown danbr...@php.net wrote: On Sat, Apr 25, 2009 at 13:50, Marc Steinert li...@bithub.net wrote: $string = preg_replace('/(.*?)/', 'font color=color\\1/font', $string); Close, but I'd also recommend dropping in a 'Us' modifier so that it is `U`ngreedy and `s`pans lines. ?php $regexp = '/(.*?)/Us'; ? -- /Daniel P. Brown daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
What parameters are you pasing in the link? That will be the telling point of what you are doing wrong. You could pass the search params ( though these are best kept in a session or cookie ) and the offset counter to get the next block of results. Sorry for top posting. Bastien Sent from my iPod On Apr 26, 2009, at 4:23, 9el le...@phpxperts.net wrote: I have pagination set up and the number for pages next has a link but the next does not. I have experimented with all sorts of configurations of the code but the only thing that works (and this is totally off the wall) is to do this *$Count* = *mysql_num_rows($results);* $Count1=*$Count++;* // without this, the next does not do the link--- but there is no other $Count1 in the code either in the original page or the include page. the script should work even if u replace $Count1 = $Count++; with $Count++; There's a NICE video tutorial available on pagination over the internet. You should watch it. You are counting the number of rows of a result. And you are asking to increase the count by 1. :D Thats not realistic. pagination is done with the help of mySQL's * LIMIT recNUMBER, count* * Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD *Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
At 1:40 PM -0400 4/25/09, Andrew Hucks wrote: If I have something like $string = 'hello there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like font color=colorhello/font there. Arrggg. Don't use: font color=colorhello/font The font tag is dead and embedded styling should moved to css. There are lot's of ways to do this, here's one: span class=red?php echo('hello'); ?/span?php echo(' there'); ? You might also check out first-child in css. That way you can make hello in red and there in whatever the element color is in one statement. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: At 1:40 PM -0400 4/25/09, Andrew Hucks wrote: If I have something like $string = 'hello there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like font color=colorhello/font there. Arrggg. Don't use: font color=colorhello/font The font tag is dead and embedded styling should moved to css. There are lot's of ways to do this, here's one: span class=red?php echo('hello'); ?/span?php echo(' there'); ? You might also check out first-child in css. That way you can make hello in red and there in whatever the element color is in one statement. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: At 1:40 PM -0400 4/25/09, Andrew Hucks wrote: If I have something like $string = 'hello there'; (the word hello is in double quotes, if you can't see it), how would I output it as something like font color=colorhello/font there. Arrggg. Don't use: font color=colorhello/font The font tag is dead and embedded styling should moved to css. There are lot's of ways to do this, here's one: span class=red?php echo('hello'); ?/span?php echo(' there'); ? You might also check out first-child in css. That way you can make hello in red and there in whatever the element color is in one statement. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formating Numbers
Gary wrote: I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points). /** * returns 4.3 as $4.30 (formats us dollars) * * @param $amount * @return string */ function us_dollar_format( $amount ) { return ( '$' . number_format($amount, 2, '.', '') ); } echo us_dollar_format(4.3); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with scandir()
Deivys Delgado Hernandez wrote: Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 try using the network path instead :) you have to do this for samba drives on windows too. $dir = '//machine.local/share/path'; regards, nathan ps: many people just don't answer if they do not know -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
At 9:47 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: span class=red?php echo('hello'); ?/span?php echo(' there'); ? I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) I fully understand, but I also see two side to this. On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class=warning and that way the client may say I don't want it red now, but orange and it will be easy enough to change. On the other side, some attributes may be exactly what they claim, such as class=center or class=red. There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic. So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes. Additional consideration, one can combine exact attributes, such as class=center red and it both works and is obvious. I often have in my css, rules such as: .center { text-align: center; } .red { color: red; } While it might not fit with the purest css, it works for me. YMMV. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote: At 9:47 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: span class=red?php echo('hello'); ?/span?php echo(' there'); ? I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) I fully understand, but I also see two side to this. On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class=warning and that way the client may say I don't want it red now, but orange and it will be easy enough to change. On the other side, some attributes may be exactly what they claim, such as class=center or class=red. There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic. So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes. Additional consideration, one can combine exact attributes, such as class=center red and it both works and is obvious. I often have in my css, rules such as: .center { text-align: center; } .red { color: red; } While it might not fit with the purest css, it works for me. YMMV. :-) Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com I think with semantic CSS names, it's more about why the text has to be red, than what colour it is. So if it's red because it is a warning, alert, etc, then it can sometimes be better to give it a name that reflects that. This is mostly down to preference though really. I say mostly, because some UA's might use the class names to derive microformat information, such as dates, author names, etc. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sun, 2009-04-26 at 11:40 -0400, tedd wrote: At 9:47 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 14:49 +0100, Ashley Sheridan wrote: On Sun, 2009-04-26 at 09:41 -0400, tedd wrote: span class=red?php echo('hello'); ?/span?php echo(' there'); ? I'd go further on that and say don't call your class 'red', as it doesn't do anything for semantic code, but that's just me trolling ;) I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? span.red { color: blue; } Uh huh, uh huh, uh huh :) I fully understand, but I also see two side to this. On one side, I agree that one should always keep attributes vague enough so they can be anything, such as class=warning and that way the client may say I don't want it red now, but orange and it will be easy enough to change. On the other side, some attributes may be exactly what they claim, such as class=center or class=red. There is little confusion about what those classes mean as compared to more vague terms. As such, exact attributes are indeed semantic. So as I see it, with *some* attributes it's a toss-up -- you can add a layer of abstraction by making them vague OR you can use a more exact (semantic) meaning. I don't find much fault with either way provided that it's not a big problem later. The dividing line here is one of how much work it causes. Additional consideration, one can combine exact attributes, such as class=center red and it both works and is obvious. I often have in my css, rules such as: .center { text-align: center; } .red { color: red; } While it might not fit with the purest css, it works for me. YMMV. :-) Your thinking is flawed. Yes you could have a class called center and it does exactly that... center the text. However to make the text left aligned you now need to edit the HTML to assign the class left intead of center. The whole point of CSS is to not edit the HTML to make stylistic changes. It maybe be obvious that having classes center and red makes the content centered and coloured red, but that is no different than having an align attribute and a color attribute which is EXACTLY what CSS is supposed to replace. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
At 11:59 AM -0400 4/26/09, Robert Cummings wrote: On Sun, 2009-04-26 at 11:40 -0400, tedd wrote: While it might not fit with the purest css, it works for me. YMMV. :-) Your thinking is flawed. Yes you could have a class called center and it does exactly that... center the text. However to make the text left aligned you now need to edit the HTML to assign the class left intead of center. The whole point of CSS is to not edit the HTML to make stylistic changes. It maybe be obvious that having classes center and red makes the content centered and coloured red, but that is no different than having an align attribute and a color attribute which is EXACTLY what CSS is supposed to replace. Cheers, Rob. Rob: I truly see your point and I don't disagree with it. However, there are times where the client says I want this centered and center it you must without giving that section of text an attribute name. Sure I could say I know the client wants this selection-of-text centered and he isn't willing (or agree) to give this selection-of-text a name, so I'll do it. I'll call it this 'selection-of-text' selection-of-text. That way years from now when the client says I no longer want that selection-of-text centered but right justified I can change a single rule in the selection-of-text class attribute and the critter will be done without me altering a single line of html. Sure, that sounds good.. But experience has shown me that when that happens, the client usually doesn't single out that specific selection-of-text the same way again but rather picks something even more convoluted thereby defeating the entire process. I realize that the entire idea here is to remove any need to alter the html to make styling changes, but clients usually negate that concept for when they want to change things, it's not just styling they want to change, but everything. Also try explaining style sheets to a client and why they should think in terms of elements, blocks of text, maintenance, separating style from presentation, and all that other noble stuff, when all they what is to make something bold, centered, red, or all three. For example, I have one client who's entire web site shows the same explanation-link on each page the exact same way and then he said Oh, on page 43, let's change that from blue and bold to red and right justified. As such, I had to write page specific code to make that single change for that specific page plus writing a new css rule. Using css the correct way would have never saved me from the additional html work. Sometimes simple is not only simpler, but easier to understand and faster to implement -- especially when you are dealing with clients who have absolutely no understanding of the proper ways of doing things. They just want their eclectic stuff shown they way they think, which is usually anything but organized. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
Robert Cummings wrote: I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? Aren't CSS class names supposed to be in lower case? I would go with something like double_quoted. span.red { color: blue; } Uh huh, uh huh, uh huh :) Cheers, Rob. -- With warm regards, Sudheer. S Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Change color of anything in double/single quotes
On Sun, 2009-04-26 at 22:52 +0530, Sudheer Satyanarayana wrote: Robert Cummings wrote: I was about to say the same thing *lol*. tis true though, the class should be doubleQuoted or something similar. What happens when they decide it should be blue? Aren't CSS class names supposed to be in lower case? I would go with something like double_quoted. CSS class names are case-sensitive. IE supports insensitivity in non-standards mode. You're probably confusing the following: C.13. Cascading Style Sheets (CSS) and XHTML 1. CSS style sheets for XHTML should use lower case element and attribute names. This does not refer to attribute values. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
9el wrote: I have pagination set up and the number for pages next has a link but the next does not. I have experimented with all sorts of configurations of the code but the only thing that works (and this is totally off the wall) is to do this *$Count* = *mysql_num_rows($results);* $Count1=*$Count++;* // without this, the next does not do the link--- but there is no other $Count1 in the code either in the original page or the include page. the script should work even if u replace $Count1 = $Count++; with $Count++; There's a NICE video tutorial available on pagination over the internet. You should watch it. You are counting the number of rows of a result. And you are asking to increase the count by 1. :D Thats not realistic. pagination is done with the help of mySQL's * LIMIT recNUMBER, count* * Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD *Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com Thanks, Lenin, I appreciate the feedback and will take a look at the video. Maybe it will expand my understanding of things and offer an alternative to several that I have already found. :-) -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Formating Numbers
Sorry for the delay in response. I was able to figure the number_format() function out. Thanks for all your responses. Gary Gary gwp...@ptd.net wrote in message news:21.39.63007.75193...@pb1.pair.com... I cant seem to get this to work for me. I want the number to be formated to money (us, 2 decimal points). I have gone through manual, tried money_format, number_format, along with setting the variable, but I cant seem to get it to work. I'm sure it is something simple I am missing. Thanks for the help. ?php $sale_value=$_POST['sale']; $assess_value=$_POST['assess']; $mil_rate=.03965; $ratio=.51; $present_tax=($assess_value) * ($mil_rate); $correct_tax=($sale_value)*($ratio)*($mil_rate); $savings=($present_tax)-($correct_tax); echo 'According to the information you have enteredbr /';?br / ?php echo You are currently paying now $ $present_taxbr /br /; echo According to the information you have submitted, your taxes should be $ $correct_tax br /;? br/?php echo According to our calculations, a successful assessment appeal could save you annually on your current real estate taxes. b$ $savings/b ; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour SOLVED
kranthi wrote: if $Count1 is never referenced after this, then certainly this assignment operation is redundent. but assignment is not the ONLY operation of this statement. if u hav not noticed a post increment operator has been used which will affect the value of $Count as well, and this operation is required for the script to work. the script should work even if u replace $Count1 = $Count++; with $Count++; Kranthi. Not quite, since that would change the $Count variable and that is used leater in the code. But the problem seems to be solved as the paging needed the $Count1 wich was not being supplied because I was debugging the code without enough entries in the database. Once I had a larger base of info I was able to see what the problem was. The code needed to determine how many instances there are in the db of the search criteria and it was not getting that; it was only getting the LIMIT of the query. So I added a few lines to determine the total for $Count1 and it all works fine now. :-) or until I find another glitch. ;-) Thanks for the suggestion. -- unheralded genius: A clean desk is the sign of a dull mind. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD Well, I went, I looked, I tried... but: I'm afraid this kind of video tutorial or any program of the like is pretty pathertic. Although the intention of the this guy Samson may be commendable, the execution is absolutely atrocious and unprofessional. By profession, I am a director, director of photography and still photography for films, videos, TV stuff, clips as well as still photos for books specialty of food, etc.; you name it. And this is just plain too boring. If he were to cut the padding, it would doubtless be interesting but 21 minutes (for just 1 of 2 clips) I'm not going to waste. During that time I can find lots of other code examples tutorials. Sorry, but this is not for me. If anyone wants any help on shooting stuff, I'll be happy to help but I cannot encourage amateurism. Oh, and while I am at it, I don't much care to Google; their search engine has gone way off course (although it is probably the best available, but I don't wish to have anything to do with any of the rest of their overblown garbage like the analytics, and especially their policies and capitalistic profit drive shown in their actions relating publishing and copyright regarding electronic media. Just love to spread the word. - Oh, yes, if you want to save the planet, start by rethinking capitalism (it hasn't worked too well, has it)... :-D Thanks for the opportunity to rant. -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL -- finding whether there's a transaction started
Bogdan Stancescu wrote: On 24-Apr-09 03:45, Chris wrote: I don't think mysql has any way of finding that out. If you're using an abstraction layer, it's easy enough in code - though rollback's are a little harder - should they do a complete rollback or just to a savepoint? Thank you for taking the time to sketch that mock-up -- yes, we were also thinking about something similar as a last resort, but I just can't believe you can't simply ask MySQL whether it's going to autocommit the next query or not... How can it know? What if a bad query comes through or a null value where there shouldn't be or a bad integer value or ... They are all situations where a transaction will be rolled back. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] inexplicable behaviour
Phpster wrote: What parameters are you pasing in the link? That will be the telling point of what you are doing wrong. You could pass the search params ( though these are best kept in a session or cookie ) and the offset counter to get the next block of results. Actually, I am trying to use sessions but I'm not sure it's working. I'll have to look throught the manuals and tutorials again to see what's not cookie-ing :-) Any suggestions on how to verify or debug sessions? Sorry for top posting. Bastien Sent from my iPod On Apr 26, 2009, at 4:23, 9el le...@phpxperts.net wrote: I have pagination set up and the number for pages next has a link but the next does not. I have experimented with all sorts of configurations of the code but the only thing that works (and this is totally off the wall) is to do this *$Count* = *mysql_num_rows($results);* $Count1=*$Count++;* // without this, the next does not do the link--- but there is no other $Count1 in the code either in the original page or the include page. the script should work even if u replace $Count1 = $Count++; with $Count++; There's a NICE video tutorial available on pagination over the internet. You should watch it. You are counting the number of rows of a result. And you are asking to increase the count by 1. :D Thats not realistic. pagination is done with the help of mySQL's * LIMIT recNUMBER, count* * Look for Pagination with PHP + MySQL and watchit http://www.google.com/url?sa=tsource=webct=rescd=10url=http%3A%2F%2Fwww.bestechvideos.com%2F2008%2F07%2F02%2Fsampsonvideos-php-pagination-part-2ei=ohn0SdnlL8KLkAWQrNTbCgusg=AFQjCNEGKOIG3791BpgeVqCiiq5-cikbRA Dont miss this SampsonVideos . PERIOD *Regards Lenin www.twitter.com/nine_L www.lenin9l.wordpress.com -- Hervé Kempf: Pour sauver la planète, sortez du capitalisme. - Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com/andypantry.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CamelCase conversion to proper_c_style
I know it's probably heresy for a lot of coders, but does anyone know a function or class or regexp or somesuch which will scan through a PHP file and convert all the CamelCase code into proper C-type code? That is, CamelCase gets converted to camel_case. I snagged a bunch of someone else's PHP code I'd like to modify, but it's coded the wrong way, so I'd like to fix it. (I'm teasing you CamelCase people. But I really would like to change this code around, because it doesn't happen to be my preference.) Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL -- finding whether there's a transaction started
Bogdan Stancescu wrote: Hello list, I'm developing a library and would need to know if the code calling my library has already started a MySQL transaction or not. I want to know whether I should start one or use savepoints instead -- starting a transaction if one is already in progress commits the existing transaction, and setting a savepoint silently fails outside transactions. And I was unable to find any non-destructive way of retrieving that information -- is there any? I don't use MySQL, having been embeded with a 'real' database since before MySQL even thought about transactions ;) but your question does not make sense from a functional point of view. The whole point of a transaction is to bundle together a packet of work. If any part of the packet fails, then it can be rolled back to a known place. If you are doing a package of work within your library, you would use your own transaction. If you are processing data for a higher level function, either that function would pass you the transaction handle, or IT would handle your return and roll back or carry on as required. Or am I simply missing something because MySQL still does not ACTUALLY support real transactions? ( This discussion may be better on the PHPDatabase list ) -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php