RE: [PHP] preview string with strlen PHP (help)
In your function there is at the end before the return statement: $previewtext = $whowcatvar; First $whowcatvar isn't defined. So it could be an answer. And I think u need to delete this line. -Message d'origine- De : Dwayne Heronimo [mailto:[EMAIL PROTECTED] Envoyé : vendredi 23 mars 2007 16:55 À : php-general@lists.php.net Objet : Re: [PHP] preview string with strlen PHP (help) Dear all, hmm.. sorry the $previewstext thing was a typo in my mail. But yes it is working but it will only display the first record of the recordset. I have like a list for items with short text in a page and of course made a query to make the database variables available. Which where the variable $row_show_cat['text']; comes from. This is why I thought that i may have to rewrite it into a function to display the $row_show_cat['text']; in a repeated reagion. I have rewritten my function: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; return $previewtext; } ? And to to show it later in the page: ?php echo previewString($row_show_cat['text']); ? but this still won't anywould display anything. :S Please let me know. Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/23/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I am very new to programming. I want to make a preview text that would display only a part of the text that is a text field in a database. //Begin Make preview string $minitxt = $row_show_cat['text']; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; //End Make preview string But if I want to display this somewhere in the page it will only display the first record of at every text column row ?php echo $previewstext ? Althought I am very new to php and programming. I thought maybe I should rewrite it into a function. But my function won't work. function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; } and to display it in the page: ?php echo previewString($row_show_cat['text']) ? IT displays notthing. But I think I am doing somthing wrong. I am assigning the wrong variables to the $row_show_cat['text']) ??? Please let me know I'm currently not sure why your first piece of code isn't working, but the second is quite simple. You aren't returning any variable in your function, and so it won't output anything. Add the following: return $previewtext; Just before the } Then it will return something, but i think not what you wanted to :( Tijnema -- 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: [PHP] preview string with strlen PHP (help)
YES this works thank nemeth: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; return $previewtext; } ? and to display it: ?php echo previewString($row_show_cat['text']); ? cheers Dwayne Németh Zoltán [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2007. 03. 23, péntek keltezéssel 16.55-kor Dwayne Heronimo ezt írta: Dear all, hmm.. sorry the $previewstext thing was a typo in my mail. But yes it is working but it will only display the first record of the recordset. I have like a list for items with short text in a page and of course made a query to make the database variables available. Which where the variable $row_show_cat['text']; comes from. This is why I thought that i may have to rewrite it into a function to display the $row_show_cat['text']; in a repeated reagion. I have rewritten my function: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; what is the meaning of the above line??? you are giving an undefined value (default NULL) to $previewtext, just after you gave it the right value delete that line and you might be well greets Zoltán Németh return $previewtext; } ? And to to show it later in the page: ?php echo previewString($row_show_cat['text']); ? but this still won't anywould display anything. :S Please let me know. Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/23/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I am very new to programming. I want to make a preview text that would display only a part of the text that is a text field in a database. //Begin Make preview string $minitxt = $row_show_cat['text']; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; //End Make preview string But if I want to display this somewhere in the page it will only display the first record of at every text column row ?php echo $previewstext ? Althought I am very new to php and programming. I thought maybe I should rewrite it into a function. But my function won't work. function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; } and to display it in the page: ?php echo previewString($row_show_cat['text']) ? IT displays notthing. But I think I am doing somthing wrong. I am assigning the wrong variables to the $row_show_cat['text']) ??? Please let me know I'm currently not sure why your first piece of code isn't working, but the second is quite simple. You aren't returning any variable in your function, and so it won't output anything. Add the following: return $previewtext; Just before the } Then it will return something, but i think not what you wanted to :( Tijnema -- 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] preview string with strlen PHP (help)
2007. 03. 23, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta: YES this works thank nemeth: your welcome but please call me Zoltán ;) (my first name is Zoltán. in Hungary we write names the opposite order than anywhere else ;) so that's why my mailbox is set to display 'Németh Zoltán' but I sign my mails as 'Zoltán Németh' showing that my first name is Zoltán and last name is Németh :) ) greets Zoltán Németh ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; return $previewtext; } ? and to display it: ?php echo previewString($row_show_cat['text']); ? cheers Dwayne Nmeth Zoltn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2007. 03. 23, pntek keltezssel 16.55-kor Dwayne Heronimo ezt rta: Dear all, hmm.. sorry the $previewstext thing was a typo in my mail. But yes it is working but it will only display the first record of the recordset. I have like a list for items with short text in a page and of course made a query to make the database variables available. Which where the variable $row_show_cat['text']; comes from. This is why I thought that i may have to rewrite it into a function to display the $row_show_cat['text']; in a repeated reagion. I have rewritten my function: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; what is the meaning of the above line??? you are giving an undefined value (default NULL) to $previewtext, just after you gave it the right value delete that line and you might be well greets Zoltn Nmeth return $previewtext; } ? And to to show it later in the page: ?php echo previewString($row_show_cat['text']); ? but this still won't anywould display anything. :S Please let me know. Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/23/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I am very new to programming. I want to make a preview text that would display only a part of the text that is a text field in a database. //Begin Make preview string $minitxt = $row_show_cat['text']; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; //End Make preview string But if I want to display this somewhere in the page it will only display the first record of at every text column row ?php echo $previewstext ? Althought I am very new to php and programming. I thought maybe I should rewrite it into a function. But my function won't work. function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; } and to display it in the page: ?php echo previewString($row_show_cat['text']) ? IT displays notthing. But I think I am doing somthing wrong. I am assigning the wrong variables to the $row_show_cat['text']) ??? Please let me know I'm currently not sure why your first piece of code isn't working, but the second is quite simple. You aren't returning any variable in your function, and so it won't output anything. Add the following: return $previewtext; Just before the } Then it will return something, but i think not what you wanted to :( Tijnema -- 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] preview string with strlen PHP (help)
On 3/23/07, Németh Zoltán [EMAIL PROTECTED] wrote: 2007. 03. 23, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta: YES this works thank nemeth: your welcome but please call me Zoltán ;) (my first name is Zoltán. in Hungary we write names the opposite order than anywhere else ;) so that's why my mailbox is set to display 'Németh Zoltán' but I sign my mails as 'Zoltán Németh' showing that my first name is Zoltán and last name is Németh :) ) greets Zoltán Németh Ever thought of reversing it in your mailbox? Or use a virtual name like me ;) Tijnema ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; return $previewtext; } ? and to display it: ?php echo previewString($row_show_cat['text']); ? cheers Dwayne Nmeth Zoltn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 2007. 03. 23, pntek keltezssel 16.55-kor Dwayne Heronimo ezt rta: Dear all, hmm.. sorry the $previewstext thing was a typo in my mail. But yes it is working but it will only display the first record of the recordset. I have like a list for items with short text in a page and of course made a query to make the database variables available. Which where the variable $row_show_cat['text']; comes from. This is why I thought that i may have to rewrite it into a function to display the $row_show_cat['text']; in a repeated reagion. I have rewritten my function: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; what is the meaning of the above line??? you are giving an undefined value (default NULL) to $previewtext, just after you gave it the right value delete that line and you might be well greets Zoltn Nmeth return $previewtext; } ? And to to show it later in the page: ?php echo previewString($row_show_cat['text']); ? but this still won't anywould display anything. :S Please let me know. Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/23/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I am very new to programming. I want to make a preview text that would display only a part of the text that is a text field in a database. //Begin Make preview string $minitxt = $row_show_cat['text']; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; //End Make preview string But if I want to display this somewhere in the page it will only display the first record of at every text column row ?php echo $previewstext ? Althought I am very new to php and programming. I thought maybe I should rewrite it into a function. But my function won't work. function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; } and to display it in the page: ?php echo previewString($row_show_cat['text']) ? IT displays notthing. But I think I am doing somthing wrong. I am assigning the wrong variables to the $row_show_cat['text']) ??? Please let me know I'm currently not sure why your first piece of code isn't working, but the second is quite simple. You aren't returning any variable in your function, and so it won't output anything. Add the following: return $previewtext; Just before the } Then it will return something, but i think not what you wanted to :( Tijnema -- 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: [PHP] preview string with strlen PHP (help)
On Fri, March 23, 2007 10:18 am, Dwayne Heronimo wrote: function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } Take out this whole else block -- Assigning a variable to itself is just silly. $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; You need to RETURN some value here, for the function to give back the answer so that your echo below has something to print out. http://php.net/return -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preview string with strlen PHP (help)
You don't need a function to do something repeatedly. You need some kind of loop, such as 'while', 'for' or 'foreach' Try working through a PHP / MySQL tutorial, as it will cover this. On Fri, March 23, 2007 10:55 am, Dwayne Heronimo wrote: Dear all, hmm.. sorry the $previewstext thing was a typo in my mail. But yes it is working but it will only display the first record of the recordset. I have like a list for items with short text in a page and of course made a query to make the database variables available. Which where the variable $row_show_cat['text']; comes from. This is why I thought that i may have to rewrite it into a function to display the $row_show_cat['text']; in a repeated reagion. I have rewritten my function: ?php function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; return $previewtext; } ? And to to show it later in the page: ?php echo previewString($row_show_cat['text']); ? but this still won't anywould display anything. :S Please let me know. Tijnema ! [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 3/23/07, Dwayne Heronimo [EMAIL PROTECTED] wrote: Dear All, I am very new to programming. I want to make a preview text that would display only a part of the text that is a text field in a database. //Begin Make preview string $minitxt = $row_show_cat['text']; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; //End Make preview string But if I want to display this somewhere in the page it will only display the first record of at every text column row ?php echo $previewstext ? Althought I am very new to php and programming. I thought maybe I should rewrite it into a function. But my function won't work. function previewString($showcatvar) { $minitxt = $showcatvar; $len = strlen($minitxt); if ($len 235) { $len = 235; } else { $len = $len; } $newstring = substr($minitxt,0,$len); $previewtext = $newstring; $previewtext = $whowcatvar; } and to display it in the page: ?php echo previewString($row_show_cat['text']) ? IT displays notthing. But I think I am doing somthing wrong. I am assigning the wrong variables to the $row_show_cat['text']) ??? Please let me know I'm currently not sure why your first piece of code isn't working, but the second is quite simple. You aren't returning any variable in your function, and so it won't output anything. Add the following: return $previewtext; Just before the } Then it will return something, but i think not what you wanted to :( Tijnema -- 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 -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: DOMXPath-Query, quotes and apostrophes
I seem to be hitting a wall here. I have the need to run an XPath query on strings that may contain quotes, apostrophes or both. Going through google turned up some interesting information, but nothing that solved my issue. An example of what I am trying to do is as follows: $query = '\'foobar'; $xpath-query('/[EMAIL PROTECTED]'.$query.']')-item(0); This produces these warnings and errors: Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid predicate Warning: DOMXPath::query() [function.DOMXPath-query]: Invalid expression Fatal error: Call to a member function item() on a non-object I've tried to escape the characters in the query, but that seems to be illegal for XPath from what I've read. I've tried turning the quotes into quot; and apostrophes into apos; but it appears that XPath requires that the data be unencoded to work. I've seen reference to using XSLT to set XPath variables instead, but I don't understand how to do implement this. I would really appreciate any examples on what people have done to get around this issue, if any one has at all. Regards, Adam. -- Adam Randall [EMAIL PROTECTED] (206) 285-8080 100 West Harrison North Tower, Suite 300 Seattle, WA 98119 Engineers like to solve problems. If there are no problems handily available, they will create their own problems. - Dilbert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me specify/develop a feature! (cluster web sessions management)
On Tue, March 13, 2007 7:27 pm, Mark wrote: I have a web session management server that makes PHP clustering easy and fast. I have been getting a number of requests for some level of redundancy. As it is, I can save to an NFS or GFS file system, and be redundant that way. Talk to Jason at http://hostedlabs.com if you haven't already. I just did, he's using memcached not MCache. The name space for this class of project is fairly limited. He's rolling out a distributed redundant PHP architecture using your MCache as an almost turn-key webhosting service. Not quite sure exactly how he's makeing the MCache bit redundant, but he's already doing it. He's using memcache, which is redundant, but it doesn't do what MCache does. The memcached program is strictly a cache for things SQL queries. MCache is more like an object data store. Here is an explanation of how it works: http://www.mohawksoft.org/?q=node/36 NB: There is a typo in False Scalability section: ... but regardless of what you do you, every design has a limit. I took me a few minutes to see the typo even after you posted it. Thanks. What would you be looking for? How would you expect redundancy to work? In the ideal world, the developers are also working as an N-tier architecture in their Personnel Org Chart. :-) One Lead has to understand the whole system and the intricacies of your system, as well as its implications and gotchas really well. In an ideal world the Lead can then arrange things so that other Developers (non lead) can just program normally and have little or no impact on their process to roll-out to the scalable architecture. This is not to say that they can squander resources, but rather that if their algorithm works correctly and quickly (enough) on their dev box with beefy datasets, it should seemlessly work on the scaled boxes, assuming the datasets are not dis-proportionately larger comparing hardware to hardware pro-rated to dataset size. Yes, if the algorithm is anything bigger than O(n) this is not really safe but it's a close rule of thumb, and you can generally figure out pretty fast if your algorithm is un-workable. At least in my experience, if I can get it to work on a relatively large dataset on my crappy dev box, the real server can deal with it. So the less intrusive the redundant architecture can be, the better. I think a lot of people go completely overboard with redundancy. Yea, you need a load balancer and multiple web servers, but outside some hypothetical requirement of never any down time, I can't see much value in trying to create a single 5 nines system. If you can't deploy two independent service platforms, you will most likely suffer a failure somewhere. I think the big focus should be ensuring data integrity and fast recovery in the event of a failure. I mean sure, if you have the capital, go for it, but you can save a lot of money on your data center if you take a more rational view of downtime. Documentation of exactly how it all works is crucial -- If it's all hand-waving, the Lead will never be able to figure out where the gotchas are going to be. I'd also expect true redundancy all across the board, down to spare screws for the rack-mounts. Hey, a screw *could* sheer off at any moment... :-) Like I said, a lot of people go nuts about redundancy. Multiple data centers on a few different continents. US, Europe, Asia, India (which seems to have caught the American consumerism big-time lately...) Australia... Probably need 2 or 3 just in the US. That really is the *only* way to prevent down time. Some folks need WAY more bigger farms than others. Offer a wide variety of choices, from a simple failsafe roll-over up to sky's-the-limit on every continent. [Well, okay, you can probably safely skip Antartica. :-)] I'm not sure it makes sense to try to target huge web farms. That really is a different problem. Think about a SQL database. As long as you can replicate to a hot spare, most web farms settle for that. A truly distributed SQL database cluster is a big deal, and most sites won't ever need it. I'd like a status board web panel of every significant piece of gear and a health status in one screen of blinking lights. :-) If I have to be the one to SysAdmin the things, make that a control panel as well. Okay, in reality, I would *not* be the one to SysAdmin that stuff, as I would still need to hire a guy actually qualified to do that. Which is why we're working with Jason (above) who's essentially our out-source SysAdmin guy taking care of all this hardware and redundancy stuff so we can focus on our WEb App from a business perspective (mostly) instead of constantly fighting with hardware. [I am so *not* a hardware guy...] And, of course, *when* an MCache box falls over, the user should seemlessly be sent to the next-closest box, with their session data already waiting for them. I have plans for a
Re: [PHP] help with script needed
Richard Lynch wrote: You could also just use: if (($i % 15) === 0) echo FooBar; elseif (($i % 3) === 0) echo Foo; elseif (($i % 5) === 0) echo Bar; 15 works because 3 and 5 are mutually prime or whatever it's called. Good point, missed that one. A minimalist might not even bother with the 15 and would skip the 'else' and just do: if (($i % 3) === 0) echo Foo; if (($i % 5) === 0) echo Bar; echo \n; I personally think that's less comprehensible, however, and less maintainable, so I'd rather see a couple more CPU cycles than have code I have to think about to figure out what it does, until it's a proven bottleneck. Except that you're not displaying the actual number when it's not divisible between 3 or 5, so that doesn't meet the spec. Sorry. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me specify/develop a feature! (cluster web sessions management)
I have a web session management server that makes PHP clustering easy and fast. I have been getting a number of requests for some level of redundancy. As it is, I can save to an NFS or GFS file system, and be redundant that way. Here is an explanation of how it works: http://www.mohawksoft.org/?q=node/36 What would you be looking for? How would you expect redundancy to work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me specify/develop a feature! (cluster web sessions management)
On Tue, March 13, 2007 7:27 pm, Mark wrote: I have a web session management server that makes PHP clustering easy and fast. I have been getting a number of requests for some level of redundancy. As it is, I can save to an NFS or GFS file system, and be redundant that way. Talk to Jason at http://hostedlabs.com if you haven't already. He's rolling out a distributed redundant PHP architecture using your MCache as an almost turn-key webhosting service. Not quite sure exactly how he's makeing the MCache bit redundant, but he's already doing it. Here is an explanation of how it works: http://www.mohawksoft.org/?q=node/36 NB: There is a typo in False Scalability section: ... but regardless of what you do you, every design has a limit. What would you be looking for? How would you expect redundancy to work? In the ideal world, the developers are also working as an N-tier architecture in their Personnel Org Chart. :-) One Lead has to understand the whole system and the intricacies of your system, as well as its implications and gotchas really well. In an ideal world the Lead can then arrange things so that other Developers (non lead) can just program normally and have little or no impact on their process to roll-out to the scalable architecture. This is not to say that they can squander resources, but rather that if their algorithm works correctly and quickly (enough) on their dev box with beefy datasets, it should seemlessly work on the scaled boxes, assuming the datasets are not dis-proportionately larger comparing hardware to hardware pro-rated to dataset size. Yes, if the algorithm is anything bigger than O(n) this is not really safe but it's a close rule of thumb, and you can generally figure out pretty fast if your algorithm is un-workable. At least in my experience, if I can get it to work on a relatively large dataset on my crappy dev box, the real server can deal with it. So the less intrusive the redundant architecture can be, the better. Documentation of exactly how it all works is crucial -- If it's all hand-waving, the Lead will never be able to figure out where the gotchas are going to be. I'd also expect true redundancy all across the board, down to spare screws for the rack-mounts. Hey, a screw *could* sheer off at any moment... :-) Multiple data centers on a few different continents. US, Europe, Asia, India (which seems to have caught the American consumerism big-time lately...) Australia... Probably need 2 or 3 just in the US. Some folks need WAY more bigger farms than others. Offer a wide variety of choices, from a simple failsafe roll-over up to sky's-the-limit on every continent. [Well, okay, you can probably safely skip Antartica. :-)] I'd like a status board web panel of every significant piece of gear and a health status in one screen of blinking lights. :-) If I have to be the one to SysAdmin the things, make that a control panel as well. Okay, in reality, I would *not* be the one to SysAdmin that stuff, as I would still need to hire a guy actually qualified to do that. Which is why we're working with Jason (above) who's essentially our out-source SysAdmin guy taking care of all this hardware and redundancy stuff so we can focus on our WEb App from a business perspective (mostly) instead of constantly fighting with hardware. [I am so *not* a hardware guy...] And, of course, *when* an MCache box falls over, the user should seemlessly be sent to the next-closest box, with their session data already waiting for them. I.e., it's not enough that there will always be a working MCache box for new users -- Logged-in users have to have their session data replicated to at least one other box. There also have to be enough spare cycles in the sum of all boxes that a single failure won't just take them all down in a dominoe effect. [shudder] So it's gotta be more like Raid 5 or whatever it is, with the session data striped across different boxes. Something like this dominoe effect bit Dreamhost in the [bleep] awhile back on their switch setup. Actually, go read all their woes on their blog/newsletter and don't do that. :-) [Though at Dreamhost pricing, it's really hard to complain...] [And at least they tell you they screwed up instead of making it a State Secret.] Speaking of pricing: Session replication is just a tiny piece of the puzzle, really. A crucial piece, relatively easy to factor out for most web apps, and a great target for optimization and modularization for that very reason. But one also needs to make the web-farm, the app-farm, and the db-farm all scalable... So if you can do ALL of those in one nice package, or even some of those, that's a Good Thing, imho, as many of the same issues you'll have for session data are the same issues for web/app/db interaction. Or you could specialize in the session replication, and be a vendor to the folks replication whole systems -- Probably better, really, to stay focussed. But either way, the price has to
Re: [PHP] help with script needed
You could also just use: if (($i % 15) === 0) echo FooBar; elseif (($i % 3) === 0) echo Foo; elseif (($i % 5) === 0) echo Bar; 15 works because 3 and 5 are mutually prime or whatever it's called. The order matters, though, as moving the 15 after the other if tests would fail, as 3 and/or 5 would kick in first. It's also a game played in grade school when learning clock arithmetic (aka the modulus operator) at least here in the Midwest, usually around 4th grade (age 10), as I recall. Each person in turn says the next number or Fizz or Buzz or FizzZBuzz, and if somebody messes up, you razz them for it, and start over at 1. The person who makes the mistake could also be out in a musical chairs sort of thing, though that risks boredom creeping in for a large group of people no longer actively playing. You do not want a roomful of bored 4th-graders. Trust me on that one. :-) If the numbers are not mutually prime, you would have to do an test as Stut posted. A minimalist might not even bother with the 15 and would skip the 'else' and just do: if (($i % 3) === 0) echo Foo; if (($i % 5) === 0) echo Bar; echo \n; I personally think that's less comprehensible, however, and less maintainable, so I'd rather see a couple more CPU cycles than have code I have to think about to figure out what it does, until it's a proven bottleneck. YMMV On Wed, March 7, 2007 4:00 pm, Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with captcha
I'm not sure but i think that you need to place your javascript inside the head tags, which you (i guess) output in header.php Tijnema On 3/9/07, Joker7 [EMAIL PROTECTED] wrote: Im trying to use a captcha script from : http://www.boutell.com/newfaq/creating/captcha.html I can get it to work with plan HTML forms but not with this PHP form I use. Any help with this would be a great help. Cheers Chris ? include header.php; ? SCRIPT LANGUAGE=Javascript //!-- // pop a windoid (Pictures) function popWin(url, w, h) { var madURL = url; var x, y, winStr; x=0; y=0; self.name=opener; winStr = height=+h+,width=+w+,screenX=+x+,left=+x+,screenY=+y+,top=+y+,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0; lilBaby = window.open(madURL, _blank, winStr); } //-- /script ? if (!strstr($_SERVER['HTTP_REFERER'], 'teaup.me.uk')) { exit (Invalid referrer); } include admin/connect.php; $s=$_SERVER[REMOTE_ADDR]; $ipbancheck=SELECT * from gb_banip where IP='$s'; $ipbancheck2=mysql_query($ipbancheck); while($ipbancheck3=mysql_fetch_array($ipbancheck2)) { $IPBANNED=$ipbancheck3[IP]; } if ($IPBANNED) { print You have been banned from posting; } else { if (!isset($_POST['submit'])) { print table border='0' cellpadding='6'trtd class='book'; print form method='post' action='try.php' name='form'; print p class=contentName:/p input type='text' name='name' size='40'br; print p class=contentCountry:/pinput type='text' name='country' size='40'br; print p class=contentHomepage/pinput type='text' name='homepage' value='http://' size='40'br; print p class=contentE-mail:/pinput type='text' name='email' size='40'br; print p class=contentAim:/pinput type='text' name='aim' size='40'br; print p class=contentICQ:/pinput type='text' name='icq' size='40'br; print p class=contentYahoo:/pinput type='text' name='yim' size='40'br; print p class=contentMSN:/pinput type='text' name='msn' size='40'br; print p class=contentComment:/p; print textarea rows='6' name='comment' cols='45'/textareabr; print input type='submit' name='submit' value='submit'; print /formbr; print p class='big'Clickable Smilies/p; print a onClick=\addSmiley(':)')\img src='images/smile.gif'/a ; print a onClick=\addSmiley(':(')\img src='images/sad.gif'/a ; print a onClick=\addSmiley(';)')\img src='images/wink.gif'/a ; print a onClick=\addSmiley(';smirk')\img src='images/smirk.gif'/a ; print a onClick=\addSmiley(':blush')\img src='images/blush.gif'/a ; print a onClick=\addSmiley(':angry')\img src='images/angry.gif'/a ; print a onClick=\addSmiley(':shocked')\img src='images/shocked.gif'/a ; print a onClick=\addSmiley(':cool')\img src='images/cool.gif'/a ; print a onClick=\addSmiley(':ninja')\img src='images/ninja.gif'/a ; print a onClick=\addSmiley('(heart)')\img src='images/heart.gif'/a ; print a onClick=\addSmiley('(!)')\img src='images/exclamation.gif'/a ; print a onClick=\addSmiley('(?)')\img src='images/question.gif'/abr; print a onclick=\addSmiley(':{blink}')\img src='images/winking.gif'/a; print A onclick=\addSmiley('{clover}')\img src='images/clover.gif'/a; print a onclick=\addSmiley(':[glasses]')\img src='images/glasses.gif'/a; print a onclick=\addSmiley(':[barf]')\img src='images/barf.gif'/a; print a onclick=\addSmiley(':[reallymad]')\img src='images/mad.gif'/a; print script language=\JavaScript\ type=\text/javascript\\n; print function addSmiley(textToAdd)\n; print {\n; print document.form.comment.value += textToAdd;; print document.form.comment.focus();\n; print }\n; print /script\n; print brbr; print p class='big'A href=\javascript:popWin('bbcode.php',400, 5)\BBCode instructions/a/p; } else if (isset($_POST['submit'])) { $name=$_POST['name']; $country=$_POST['country']; $email=$_POST['email']; $homepage=$_POST['homepage']; $aim=$_POST['aim']; $icq=$_POST['icq']; $yim=$_POST['yim']; $msn=$_POST['msn']; $comment=$_POST['comment']; if(!$name || !$comment) { print font color='red'Name or comment not entered, please go back and sign again/fontbr; } else { $r=$_SERVER[REMOTE_ADDR]; $day=date(D M d, Y H:i:s); $timegone=date(U) ; //seconds since Jan 1st, 1970 $putinguestbook=INSERT INTO gbook(name, country, mail, homepage, comment, realtime, aim, icq, yim, msn, time,IP) VALUES('$name','$country','$email','$homepage','$comment','$day','$aim','$icq','$yim','$msn','$timegone','$r'); mysql_query($putinguestbook); print Thanks for posting, you will now be redirected META HTTP-EQUIV = 'Refresh' Content = '2; URL =index.php' ; } } } ? /td/tr/table /center ? include footer.php; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with the php bug in the Squirrelmail plugin's script
Hi I'd like to ask you for the help I'm using Squirellmail with plugin Shared calendar. This is simple nice plugin written by Paul Lesniewski But I found the bug in this plugin. The bug seems to be related with variable and memory. The scripts are really slow and sometimes takes 20-30 seconds under some conditions. Unfortunately Paul is busy and has no time to examine it. Just told me that it seems like there is a problem in that all files are inspected even when it just needs to look for one file. I found out what caused this delay and what action but I'm not good programmer therefore I cannot repair it by myself Can anybody look at this plugin and bug ? I can provide more information Can anybody give me some advice how to proceed? Thanks Pet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with the php bug in the Squirrelmail plugin's script
If there are no people willing to, i am, but i don't have a lot of time. I hope it isn't urgent. Tijnema On 3/9/07, Jevos, Peter [EMAIL PROTECTED] wrote: Hi I'd like to ask you for the help I'm using Squirellmail with plugin Shared calendar. This is simple nice plugin written by Paul Lesniewski But I found the bug in this plugin. The bug seems to be related with variable and memory. The scripts are really slow and sometimes takes 20-30 seconds under some conditions. Unfortunately Paul is busy and has no time to examine it. Just told me that it seems like there is a problem in that all files are inspected even when it just needs to look for one file. I found out what caused this delay and what action but I'm not good programmer therefore I cannot repair it by myself Can anybody look at this plugin and bug ? I can provide more information Can anybody give me some advice how to proceed? Thanks Pet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Stut wrote: Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php $upto = 100; $cur = 1; for ($cur = 1; $cur = $upto; $cur++) { if ($cur % 3 == 0) { print 'Fizz'; if ($cur % 5 == 0) print 'Buzz'; } else if ($cur % 5 == 0) { print 'Buzz'; } else { print $cur; } print br /; } no need to do each modulo twice per iteration :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with script needed
I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Tijnema -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
try this if ($i%5 == 0) echo foobr; -afan I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- 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] help with script needed
oops, ofcourse whe have the modular :) On 3/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: try this if ($i%5 == 0) echo foobr; -afan I have a little script that prints a number out from 1 to 100 [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; } ? [/php] I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? -- ::Bruce:: -- 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] help with script needed
Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
Are you only using 3 and 5? just echo 3 and 5 instead of Foo and Bar. and for both, just have a 3rd condition including both ... if (($i%3 ==0) ($i%5 == 0)) echo both or foobar.. does this help? Jake - Original Message - From: Bruce Gilbert [EMAIL PROTECTED] To: Martin Marques martin@bugs.unl.edu.ar Cc: Tijnema ! [EMAIL PROTECTED]; PHP-General php-general@lists.php.net Sent: Wednesday, March 07, 2007 4:00 PM Subject: Re: [PHP] help with script needed Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. thanks On 3/7/07, Martin Marques martin@bugs.unl.edu.ar wrote: Tijnema ! escribió: On 3/7/07, Bruce Gilbert [EMAIL PROTECTED] wrote: I just need to add code to print something different, say foo if the output is a multiple of 5 or 10 for example. How do I go about doing this? I've seen that question a lot, what i use is fairly simple if( intval($number / $multiple) == ($number / $multiple ) ) try that Very bad solution. Try the % operator: if($number % $multiple == 0) http://www.php.net/manual/en/language.operators.arithmetic.php -- select 'mmarques' || '@' || 'unl.edu.ar' AS email; - Martín Marqués | Programador, DBA Centro de Telemática| Administrador Universidad Nacional del Litoral - -- ::Bruce:: -- 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] help with script needed
Bruce Gilbert wrote: Thanks for the responses so far. This is what I have come up with [php] ?php for( $i=1; $i=100; $i++ ) { echo $i; echo br; if ($i%3 == 0) echo Foo ; elseif ($i%5 == 0) echo Bar; } ? [/php] and the results can be seen here http://www.inspired-evolution.com/image_test/numbers_output.php I actually want the Foo and Bar to replace the numbers they are dereivatives of and not appear below as they are now, and I also need to add a third condition for FooBar which would be for numbers that are both divisible by 3 and 5. Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with script needed
LOL I told'ya I rememberd it from my 2nd semester :) Ok, this is commonly known as the FizzBuzz problem and is used a lot as a university project or interview question. If you can't do it, be afraid!! http://dev.stut.net/php/fizzbuzz.php -Stut -- 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] Help with a within week function
I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? Thanks! Joey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with a within week function
I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? (You might get better answers from the MySQL list when asking MySQL questions.) SELECT * from table where record_date between '$begin_date' and '$end_date'; JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with a within week function
On 3/5/07, Jim Moseby [EMAIL PROTECTED] wrote: I have been trying to find a way to search a DB and match a range within a week ( php mysql ). This doesn't make sense, so I will describe it in more detail. Hi everyone, I need help with a search, lets say a record has a date of 2/5/2007 and if someone visits the website between 2/5/07 and 2/11/07 I want to display the record with 2/5/2007. If it's within the week so to speak. Does anyone know how I can accomplish this? (You might get better answers from the MySQL list when asking MySQL questions.) SELECT * from table where record_date between '$begin_date' and '$end_date'; JM There's probably a solution in here as well: $queryLocation1 = SELECT `mrem_per_hour` as `Loc1`, if((date_time = DATE_SUB(now(), interval 2 minute)), 'display', 'noDisplay') as `test` FROM `location1` ORDER BY `date_time` DESC LIMIT 1; David
Fw: [PHP] Help! I cannot send e-mail to your mail groups
Hello Again, If I send e-mail to your group, I have an error message below. There aren't any network problems. I try to send mail different places but I get same error message. May be, you can restrict Turkish IP address blocks becuase I haven't see any message from Turkey recently in your mail lists. May be, you can restrict my mail address in your group. I'm writing a book about PHP and I love helping any people about PHP on the world. Can you help me in this issuse? What is the problem? and this problem has been for 2 weeks. 2 weeks ago, I could send mail your groups easily. I'm looking forward from hear you. Error Message: Outlook Express could not post your message. Subject 'Re: PHP and cron', Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E - Original Message - From: Németh Zoltán [EMAIL PROTECTED] To: Haydar Tuna [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, March 02, 2007 12:19 PM Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups 2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta: Hello, I have been Linux user for 7 years and I have been membership of Linux Community group for 3 years in Turkey. As you know, linux users share all of experiences and knownledges and I'm writing a book about PHP. I'm a PHP professional for this reason I want to help any people on the world but I haven't send a message for two days. I got an abuse e-mail two times but there isn't any problem my mails that I have send your mail group. I want to send e-mail your mail group again, I want to help any people on the world again if possible. Can you help me? I'm looking forward here you. It seems to me you can send mail to the list, as I have received it ;) (or maybe I misunderstood your problem?) greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] Help! I cannot send e-mail to your mail groups
2007. 03. 2, péntek keltezéssel 13.42-kor Haydar Tuna ezt írta: Hello Again, If I send e-mail to your group, I have an error message below. There aren't any network problems. I try to send mail different places but I get same error message. May be, you can restrict Turkish IP address blocks becuase I haven't see any message from Turkey recently in your mail lists. May be, you can restrict my mail address in your group. I'm writing a book about PHP and I love helping any people about PHP on the world. Can you help me in this issuse? What is the problem? and this problem has been for 2 weeks. 2 weeks ago, I could send mail your groups easily. I'm looking forward from hear you. Error Message: Outlook Express could not post your message. Subject 'Re: PHP and cron', Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E hmm I must admit I don't know anything about using NNTP on news.php.net... I simply send all mails to php-general@lists.php.net (with SMTP) and no problem... I subscribed to the list at http://www.php.net/mailing-lists.php and sent back a confirmation email and that's all... greets Zoltán Németh - Original Message - From: Németh Zoltán [EMAIL PROTECTED] To: Haydar Tuna [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, March 02, 2007 12:19 PM Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups 2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta: Hello, I have been Linux user for 7 years and I have been membership of Linux Community group for 3 years in Turkey. As you know, linux users share all of experiences and knownledges and I'm writing a book about PHP. I'm a PHP professional for this reason I want to help any people on the world but I haven't send a message for two days. I got an abuse e-mail two times but there isn't any problem my mails that I have send your mail group. I want to send e-mail your mail group again, I want to help any people on the world again if possible. Can you help me? I'm looking forward here you. It seems to me you can send mail to the list, as I have received it ;) (or maybe I misunderstood your problem?) greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! I cannot send e-mail to your mail groups
:) -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net Haydar Tuna [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello Again, If I send e-mail to your group, I have an error message below. There aren't any network problems. I try to send mail different places but I get same error message. May be, you can restrict Turkish IP address blocks becuase I haven't see any message from Turkey recently in your mail lists. May be, you can restrict my mail address in your group. I'm writing a book about PHP and I love helping any people about PHP on the world. Can you help me in this issuse? What is the problem? and this problem has been for 2 weeks. 2 weeks ago, I could send mail your groups easily. I'm looking forward from hear you. Error Message: Outlook Express could not post your message. Subject 'Re: PHP and cron', Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E - Original Message - From: Németh Zoltán [EMAIL PROTECTED] To: Haydar Tuna [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, March 02, 2007 12:19 PM Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups 2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta: Hello, I have been Linux user for 7 years and I have been membership of Linux Community group for 3 years in Turkey. As you know, linux users share all of experiences and knownledges and I'm writing a book about PHP. I'm a PHP professional for this reason I want to help any people on the world but I haven't send a message for two days. I got an abuse e-mail two times but there isn't any problem my mails that I have send your mail group. I want to send e-mail your mail group again, I want to help any people on the world again if possible. Can you help me? I'm looking forward here you. It seems to me you can send mail to the list, as I have received it ;) (or maybe I misunderstood your problem?) greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! I cannot send e-mail to your mail groups
Hello, I have been Linux user for 7 years and I have been membership of Linux Community group for 3 years in Turkey. As you know, linux users share all of experiences and knownledges and I'm writing a book about PHP. I'm a PHP professional for this reason I want to help any people on the world but I haven't send a message for two days. I got an abuse e-mail two times but there isn't any problem my mails that I have send your mail group. I want to send e-mail your mail group again, I want to help any people on the world again if possible. Can you help me? I'm looking forward here you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with directory listing code
On Wed, February 21, 2007 10:41 am, Joker7 wrote: Hi - I'm having a bit of a problem with this directory listing code, found it some time ago and have been modifying it.I have run up against one or two problems. 1\ How can I make it not list its self 2\ Is there away to specify what files it list 3\add a more clear back button My php is not that good and I have hit a wall so any help would be appreciated. Chris ?php $allow_parent = false; $path=$_GET[path]; $SCRIPT_NAME=getenv(SCRIPT_NAME); if (!isset($path)) { $path = ./; } if (strstr($path,..)) { echo h2No path!/h2; exit; } $base_dir = getcwd(); chdir($path); $current_dir = getcwd(); $directory = dir(./); $directories_array = array(); $files_array = array(); while ($file = $directory-read()) { //I think you want this: if ($file === '.' || $file === '..') continue; if (is_dir($file) AND $file != .) { $directories_array[] = $file; } if (is_file($file)){ $files_array[] = $file; } } $directory-close(); echo ; echo table width=100% border=0 cellspacing=0 cellpadding=0; echo thName/thth width=50Size/thth width=70Date/th/tr; sort($directories_array); foreach($directories_array as $value) { if ($value==..) { $new_path=strrev(substr(strstr(substr(strstr(strrev($path),/),1),/),1)); } else { $new_path=$path.$value; } if (($value != ..) OR ($base_dir != $current_dir)) { echo trtdfont face=Verdana size=1a href=\$SCRIPT_NAME?path=.urlencode($new_path./).\b$value/b/a/font/tdtd/tdtdfont face=Arial size=1.gmdate(M Y,filemtime($value))./font/td/tr; } elseif ($allow_parent == true) { echo trtd/tdtd/tdtd/td/tr; } } sort($files_array); foreach($files_array as $value) { if($value != basename($SCRIPT_NAME) or $path!=./) { $filesize=filesize($value); if ($filesize 1073741823) { $filesize = sprintf(%.1f,($filesize/1073741824)). GB; } elseif ($filesize 1048575) { $filesize = sprintf(%.1f,($filesize/1048576)). MB; } elseif ($filesize 1023) { $filesize = sprintf(%.1f,($filesize/1024)). kB; } else{ $filesize = $filesize. byte; } echo trtdfont face=Verdana size=1i$value/i/font/tdtdfont face=Arial size=1$filesize/font/tdtdfont face=Arial size=1.gmdate(M Y,filemtime($value))./font/td/tr; } } echo /table; echo ; echo ; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with sessions on Log in and Log out
I am having some problem working with my script on session stuffs. Well, i have a login page which authenticates users by using sql script then if login is successful i have PHP Code: $_SESSSION['logged in']=true; and $_SESSION[userid]=$userid and when login is true i have included the page based on the access level of users . Like if it is a regular user i have include user.php ; exit() and if admin i have included admin page. Also i have a log out script which unsets the sessions variable and distroy the session at last. Also when admin loggs in to admin page i have a small php script that checks for those session variables and if the are set and is true then the pages are displayed. My problem is when admin just comes out to the login page again without log out it allows to login to the main page but in main page if any a href link is clicked it goes back to login page. So then i will have to go back and log out first and then log in.. I am not sure why this strange things happens. Also is there any way i can have a feature like when the users click back button it wont allow to go back to that page unless he is using the back button provided by the web interface. I am new at the session stuffs, so i am not sure what i am doing is really a safe way to code a php page. are there any other things that i need to be aware of while using sessions. Any suggestions or thoughts would be highly appreciated. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matching numbers 0-100
Richard Lynch wrote: On Sat, February 3, 2007 10:55 am, Chilling Lounge Admin wrote: I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? look at pron for half an hour and all of a sudden your code will rewrite itself. or alternatively learn to write regular expressions - for which me recommend RTFM - I assume they still advise actually reading at school? Deja Vu! ?php if (!preg_match('/^[0-9]+$/', $input)){ die(invalid input\n); } $input = (int) $input; switch (true){ case $input 0: die(invalid input\n); break; case $input = 15: echo image 1 to 15\n; break; case $input = 30: echo image 16 to 30\n; break; default: die(invalid input\n); break; } ? If this is homework, you'd better go hire a tutor NOW, because it ain't gonna get any easier than this... especially when your doing it for him ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matching numbers 0-100
On Sat, February 3, 2007 10:55 am, Chilling Lounge Admin wrote: I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? Deja Vu! ?php if (!preg_match('/^[0-9]+$/', $input)){ die(invalid input\n); } $input = (int) $input; switch (true){ case $input 0: die(invalid input\n); break; case $input = 15: echo image 1 to 15\n; break; case $input = 30: echo image 16 to 30\n; break; default: die(invalid input\n); break; } ? If this is homework, you'd better go hire a tutor NOW, because it ain't gonna get any easier than this... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with matching numbers 0-100
Hi. I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with matching numbers 0-100
Chilling Lounge Admin wrote: Hi. I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? Thanx if(preg_match('/(\d+)/', $variable, $matches) { if($matches[1] N $matches[1] N2) { / do your thing } } ?php $variable = image-number 16. jpg; if(preg_match('/(\d+)/', $variable, $matches)) { if($matches[1] 4 $matches[1] 20) { echo $matches[1] . is in range\n; } else echo $matches[1] . out of range\n; } ? -- _ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help wtih a query?
- Original Message - From: Jon Anderson [EMAIL PROTECTED] To: Skip Evans [EMAIL PROTECTED] Cc: PHP-General php-general@lists.php.net Sent: Tuesday, January 30, 2007 11:46 PM Subject: Re: [PHP] Help wtih a query? Wrong list. Putting $sql=... in there doesn't make it a PHP question. ;-) Skip Evans wrote: Is that what the left/right joins do??? Yea. LEFT JOIN will give you NULL entries in the left joined table, so you'd just have to say WHERE ISNULL(left joined table.some field in that table). Of course, you'll need to do the right JOINs in there for that to work. Personally, I think that implicit joins are sloppy, so I would suggest using JOIN with ON or USING...but I suppose that's a preference thing, and some (all?) might disagree with me. SQL engines have many techniques to improve the performance of the queries, with dozens of scholarly papers backing each slight improvement. The more the SQL engine knows about your intentions, the better chances it has to apply the best techniques to improve the performance of your query. For a particular engine, only a subset of all these tricks might be implemented so little might be gained from writing queries this way instead of that way and this might change with each version but it still holds that the chances for better performance improve if you make it clear what you want, eventually. Satyam jon -- 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] Help wtih a query?
Hey all, I have the following query: $sql=SELECT count(*) AS count,votes.storyID,stories.title,stories.storyID as sID,stories.approved, stories.story,stories.userID, fname, lname FROM `bsp_story_votes` as votes, bsp_story_stories AS stories, users AS usr WHERE votes.storyID=stories.storyID AND stories.userID=usr.id AND stories.contestID=$contestID GROUP BY votes.storyID ORDER BY stories.approved,count DESC, sID ASC LIMIT $b_recno,$recs; How would this need to be changed so that it would return rows for the members of the bsp_story_stories table that do not have records in the bsp_story_votes table? Is that what the left/right joins do??? Thanks! Skip -- Skip Evans Big Sky Penguin, LLC 61 W Broadway Butte, Montana 59701 406-782-2240 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL development framework. http://phpenguin.bigskypenguin.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help wtih a query?
Wrong list. Putting $sql=... in there doesn't make it a PHP question. ;-) Skip Evans wrote: Is that what the left/right joins do??? Yea. LEFT JOIN will give you NULL entries in the left joined table, so you'd just have to say WHERE ISNULL(left joined table.some field in that table). Of course, you'll need to do the right JOINs in there for that to work. Personally, I think that implicit joins are sloppy, so I would suggest using JOIN with ON or USING...but I suppose that's a preference thing, and some (all?) might disagree with me. jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help wtih a query?
Skip Evans wrote: Hey all, I have the following query: $sql=SELECT count(*) AS count,votes.storyID,stories.title,stories.storyID as sID,stories.approved, stories.story,stories.userID, fname, lname FROM `bsp_story_votes` as votes, bsp_story_stories AS stories, users AS usr WHERE votes.storyID=stories.storyID AND stories.userID=usr.id AND stories.contestID=$contestID GROUP BY votes.storyID ORDER BY stories.approved,count DESC, sID ASC LIMIT $b_recno,$recs; How would this need to be changed so that it would return rows for the members of the bsp_story_stories table that do not have records in the bsp_story_votes table? Is that what the left/right joins do??? Look up 'left outer join' I believe that is what you are looking for. -B Thanks! Skip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help wtih a query?
On Jan 30, 2007, at 4:33 PM, Skip Evans wrote: Hey all, I have the following query: $sql=SELECT count(*) AS count,votes.storyID,stories.title,stories.storyID as sID,stories.approved, stories.story,stories.userID, fname, lname FROM `bsp_story_votes` as votes, bsp_story_stories AS stories, users AS usr WHERE votes.storyID=stories.storyID AND stories.userID=usr.id AND stories.contestID=$contestID GROUP BY votes.storyID ORDER BY stories.approved,count DESC, sID ASC LIMIT $b_recno,$recs; How would this need to be changed so that it would return rows for the members of the bsp_story_stories table that do not have records in the bsp_story_votes table? Is that what the left/right joins do??? Thanks! Skip This may be closer to what you're wanting... query SELECT count(stories.*) AS count, votes.storyID, stories.title, stories.storyID AS sID, stories.approved, stories.story, stories.userID, fname, lname FROM bsp_story_votes AS votes LEFT JOIN (bsp_story_stories AS stories ON votes.storyID = stories.storyID) INNER JOIN users AS usr ON stories.userID = usr.id WHERE stories.contestID=$contestID GROUP BY votes.storyID ORDER BY stories.approved, count DESC, sID ASC LIMIT $b_recno, $recs /query If that doesn't work, you may try changing the LEFT to RIGHT. I probably screwed it up, but that's closer to how JOINs work. I'm not sure if the GROUP BY will work with this query either??? I thought you had to use HAVING with a GROUP BY? Refer to the M*SQL manual. Now that think about it... I don't know if you can have a 'count()' in with that query. If it doesn't work, you may try pulling count() out and just using m*sql_num_rows() afterwards to get the count. Hope that helps! ~Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Inventory
Brandon Bearden wrote: What I WANT to see is something like this DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK |HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY GENRE: ACTION - 1 TITLES 20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 GENRE: COMEDY - 2 TITLES 20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 What I HAVE RIGHT NOW IS: DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK |HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY 20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 Thanks for you help :) I appreciate it very much. Roman Neuhauser [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800: Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $count = 0; while ( $row = mysql_fetch_array( $invlist ) ) { if ( $count % 1 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } echo HEREDOC tr bgcolor={$rowColor} td class='body'{$row['dvdId']/td td{$row['dvdTitle']}/td td class='body'{$row['dvdGenre']}/td td{$row['dvdGenre2']}/td td class='body'{$row['dvdGenre3']}/td td{$row['dvdActive']}/td td class='body'{$row['dvdOnHand']}/td td{$row['backordered']}/td td class='body'{$row['dvdHoldRequests']}/td td{$row['incomingInverntory']}/td td class='body'{$row['ogUserId']}/td td{$row['outDate']}/td td class='body'{$row['outUserId']}/td td{$row['inDate']}/td td class='body'{$row['inUserId']}/td td{$row['cycles']}/td /tr HEREDOC; $count++; echo '/tbody/table'; } } I don't understand how the quotient works there. I will sometime. I also don't understand the HEREDOC concept. I wanted colors alternating to allow for a better read. Ignore the heredoc thing, the quotient (remainder after division) works just like it worked in your math class, but it should be if ( $count % 2 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } Although I'd use $rowColors = array('', '#c1c1c1'); ... $rowColor = $rowColors[$count % 2]; I still have not solved the problem with listing the genre in its own row, alone at the beginning of each section of genre (the start of each unique genre which is the ORDER BY in the statement). Thanks for the code. I need to learn how to write more eloquently like you. If anyone can figure out the a row listing for the genres, that would be s cool. You want something like this? genre | #id | title | #id | title | #id | title ---+-+---+-+---+-+ horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 This should give you an idea of what you should have for displaying the header/genre/section name $oldGenre = ''; while( $row = fetch_row() ) { if ( $oldGenre != $row['genre'] ) { echo 'trth align=left colspan=16'. $row['genre'].'/td/tr'; $oldGenre = $row['genre']; } // format the following with your table print_r($row); } Also, be warned, I noticed that I missed something in my first reply to you. I have the closing table tag inside the while loop. So you need to move that outside the while loop. Jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [HELP] Fatal error when uploading large files!
Hi everyone, Hopefully you all can help! I¹m at a loss as to what to do next. I¹m running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the following PHP error when trying to upload a larger file. I have AllowOverride turned on in the httpd.conf file so my .htaccess file is below as well. When I look at phpinfo() it reflects the changes in the .htaccess file but yet still I get the following PHP fatal error. Anyone have any ideas what could be going on? Could it be the Zend Memory Manager (something that I know nothing about)? Or anything else I may not be aware of? Any help would be greatly appreciated! Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 19590657 bytes) in /path/to/php/file on line 979 LimitRequestBody 0 php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300 doesn't seem to me that it is following the directives for memory size OR or you are up against a 20mb disk quota possibly??? How would I check to see if I'm up against a 20md disk quota? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [HELP] Fatal error when uploading large files!
Hi everyone, Hopefully you all can help! I¹m at a loss as to what to do next. I¹m running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the following PHP error when trying to upload a larger file. I have AllowOverride turned on in the httpd.conf file so my .htaccess file is below as well. When I look at phpinfo() it reflects the changes in the .htaccess file but yet still I get the following PHP fatal error. Anyone have any ideas what could be going on? Could it be the Zend Memory Manager (something that I know nothing about)? Or anything else I may not be aware of? Any help would be greatly appreciated! Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 19590657 bytes) in /path/to/php/file on line 979 LimitRequestBody 0 php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300 php_value can't overrule a php_admin_value (your apache conf or another .htaccess maybe setting these ini settings usiong php_admin_value). check that the php ini settings you've got in your .htaccess are actually being honored: foreach (array('memory_limit','post_max_size','upload_max_filesize') as $ini) echo ini_get($ini),'br /'; I ran the foreach like you have and the values came back with the ones I'm using in my .htaccess file. I couldn't find any occurrences of php_admin_value used any where. Hm. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [HELP] Fatal error when uploading large files!
On Tue, January 23, 2007 1:48 pm, Jay Paulson wrote: php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300 I *think* PHP (used to?) take the MINIMUM of the php.ini and .htaccess memory sizes. The reason being that your webhost should not have an application developer over-riding that limit in php.ini... Of course, if an app developer wants a smaller number, that's fine. I don't guarantee this answer is correct. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Inventory
Here is my rendition of your script. Give it a shot... Let me know if you have any question about what is going on. I was curious, what is the point of having the alternating column colors? Was that your intention? ?php function invlistONE(){ dbconnect('connect'); $invlist = mysql_query(SELECT * FROM sp_dvd ORDER BY dvdGenre); echo HEREDOC style type=text/css .dvdDisplay th { font-size: 9pt; text-align: left; } .dvdDisplay td { font-size: 8pt; } /style table cellspacing=0 id='dvdDisplay thead tr th width=20 class=bodyDVD ID/th th width=225TITLE/th th width=75 class=bodyGENRE 1/th th width=75GENRE 2/th th width=75 class=bodyGENRE 3/th th width=10ACT/th th width=10 class=bodyQTY/th th width=10BCK/b/th th width=10 class=bodyHLD/th th width=10INC/b/th th width=50 class=bodyOG USR/th th width=30OUT DATE/th th width=55 class=bodyOUT USR/th th width=30IN DATE/th th width=50 class=bodyIN USR/th th width=10CY/th /tr /thead tbody HEREDOC; $count = 0; while ( $row = mysql_fetch_array( $invlist ) ) { if ( $count % 1 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } echo HEREDOC tr bgcolor={$rowColor} td class='body'{$row['dvdId']/td td{$row['dvdTitle']}/td td class='body'{$row['dvdGenre']}/td td{$row['dvdGenre2']}/td td class='body'{$row['dvdGenre3']}/td td{$row['dvdActive']}/td td class='body'{$row['dvdOnHand']}/td td{$row['backordered']}/td td class='body'{$row['dvdHoldRequests']}/td td{$row['incomingInverntory']}/td td class='body'{$row['ogUserId']}/td td{$row['outDate']}/td td class='body'{$row['outUserId']}/td td{$row['inDate']}/td td class='body'{$row['inUserId']}/td td{$row['cycles']}/td /tr HEREDOC; $count++; echo '/tbody/table'; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [HELP] Fatal error when uploading large files!
Hi everyone, Hopefully you all can help! I¹m at a loss as to what to do next. I¹m running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the following PHP error when trying to upload a larger file. I have AllowOverride turned on in the httpd.conf file so my .htaccess file is below as well. When I look at phpinfo() it reflects the changes in the .htaccess file but yet still I get the following PHP fatal error. Anyone have any ideas what could be going on? Could it be the Zend Memory Manager (something that I know nothing about)? Or anything else I may not be aware of? Any help would be greatly appreciated! Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 19590657 bytes) in /path/to/php/file on line 979 LimitRequestBody 0 php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300
Re: [PHP] [HELP] Fatal error when uploading large files!
Jay Paulson wrote: Hi everyone, Hopefully you all can help! I¹m at a loss as to what to do next. I¹m running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the following PHP error when trying to upload a larger file. I have AllowOverride turned on in the httpd.conf file so my .htaccess file is below as well. When I look at phpinfo() it reflects the changes in the .htaccess file but yet still I get the following PHP fatal error. Anyone have any ideas what could be going on? Could it be the Zend Memory Manager (something that I know nothing about)? Or anything else I may not be aware of? Any help would be greatly appreciated! Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 19590657 bytes) in /path/to/php/file on line 979 LimitRequestBody 0 php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300 doesn't seem to me that it is following the directives for memory size OR or you are up against a 20mb disk quota possibly??? -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [HELP] Fatal error when uploading large files!
Jay Paulson wrote: Hi everyone, Hopefully you all can help! I¹m at a loss as to what to do next. I¹m running PHP 5.1.2 with Apache 2.0.55 on RedHat ES4 and I keep getting the following PHP error when trying to upload a larger file. I have AllowOverride turned on in the httpd.conf file so my .htaccess file is below as well. When I look at phpinfo() it reflects the changes in the .htaccess file but yet still I get the following PHP fatal error. Anyone have any ideas what could be going on? Could it be the Zend Memory Manager (something that I know nothing about)? Or anything else I may not be aware of? Any help would be greatly appreciated! Fatal error: Allowed memory size of 20971520 bytes exhausted (tried to allocate 19590657 bytes) in /path/to/php/file on line 979 LimitRequestBody 0 php_value memory_limit 40M php_value post_max_size 30M php_value upload_max_filesize 30M php_value display_errors On php_value max_execution_time 300 php_value max_input_time 300 php_value can't overrule a php_admin_value (your apache conf or another .htaccess maybe setting these ini settings usiong php_admin_value). check that the php ini settings you've got in your .htaccess are actually being honored: foreach (array('memory_limit','post_max_size','upload_max_filesize') as $ini) echo ini_get($ini),'br /'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Inventory
Thank you for your help. I see what you are doing different. I don't understand how the quotient works there. I will sometime. I also don't understand the HEREDOC concept. I wanted colors alternating to allow for a better read. I still have not solved the problem with listing the genre in its own row, alone at the beginning of each section of genre (the start of each unique genre which is the ORDER BY in the statement). Thanks for the code. I need to learn how to write more eloquently like you. If anyone can figure out the a row listing for the genres, that would be s cool. Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Here is my rendition of your script. Give it a shot... Let me know if you have any question about what is going on. I was curious, what is the point of having the alternating column colors? Was that your intention? ?php function invlistONE(){ dbconnect('connect'); $invlist = mysql_query(SELECT * FROM sp_dvd ORDER BY dvdGenre); echo HEREDOC style type=text/css .dvdDisplay th { font-size: 9pt; text-align: left; } .dvdDisplay td { font-size: 8pt; } /style table cellspacing=0 id='dvdDisplay thead tr th width=20 class=bodyDVD ID/th th width=225TITLE/th th width=75 class=bodyGENRE 1/th th width=75GENRE 2/th th width=75 class=bodyGENRE 3/th th width=10ACT/th th width=10 class=bodyQTY/th th width=10BCK/b/th th width=10 class=bodyHLD/th th width=10INC/b/th th width=50 class=bodyOG USR/th th width=30OUT DATE/th th width=55 class=bodyOUT USR/th th width=30IN DATE/th th width=50 class=bodyIN USR/th th width=10CY/th /tr /thead tbody HEREDOC; $count = 0; while ( $row = mysql_fetch_array( $invlist ) ) { if ( $count % 1 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } echo HEREDOC tr bgcolor={$rowColor} td class='body'{$row['dvdId']/td td{$row['dvdTitle']}/td td class='body'{$row['dvdGenre']}/td td{$row['dvdGenre2']}/td td class='body'{$row['dvdGenre3']}/td td{$row['dvdActive']}/td td class='body'{$row['dvdOnHand']}/td td{$row['backordered']}/td td class='body'{$row['dvdHoldRequests']}/td td{$row['incomingInverntory']}/td td class='body'{$row['ogUserId']}/td td{$row['outDate']}/td td class='body'{$row['outUserId']}/td td{$row['inDate']}/td td class='body'{$row['inUserId']}/td td{$row['cycles']}/td /tr HEREDOC; $count++; echo '/tbody/table'; } } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Inventory
# [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800: Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $count = 0; while ( $row = mysql_fetch_array( $invlist ) ) { if ( $count % 1 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } echo HEREDOC tr bgcolor={$rowColor} td class='body'{$row['dvdId']/td td{$row['dvdTitle']}/td td class='body'{$row['dvdGenre']}/td td{$row['dvdGenre2']}/td td class='body'{$row['dvdGenre3']}/td td{$row['dvdActive']}/td td class='body'{$row['dvdOnHand']}/td td{$row['backordered']}/td td class='body'{$row['dvdHoldRequests']}/td td{$row['incomingInverntory']}/td td class='body'{$row['ogUserId']}/td td{$row['outDate']}/td td class='body'{$row['outUserId']}/td td{$row['inDate']}/td td class='body'{$row['inUserId']}/td td{$row['cycles']}/td /tr HEREDOC; $count++; echo '/tbody/table'; } } I don't understand how the quotient works there. I will sometime. I also don't understand the HEREDOC concept. I wanted colors alternating to allow for a better read. Ignore the heredoc thing, the quotient (remainder after division) works just like it worked in your math class, but it should be if ( $count % 2 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } Although I'd use $rowColors = array('', '#c1c1c1'); ... $rowColor = $rowColors[$count % 2]; I still have not solved the problem with listing the genre in its own row, alone at the beginning of each section of genre (the start of each unique genre which is the ORDER BY in the statement). Thanks for the code. I need to learn how to write more eloquently like you. If anyone can figure out the a row listing for the genres, that would be s cool. You want something like this? genre | #id | title | #id | title | #id | title ---+-+---+-+---+-+ horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help With Inventory
What I WANT to see is something like this DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK |HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY GENRE: ACTION - 1 TITLES 20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 GENRE: COMEDY - 2 TITLES 20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 What I HAVE RIGHT NOW IS: DVD ID | TITLE | GENRE 1 | GENRE 2 | GENRE 3 | ACT | QTY BCK |HLD | INC | OG USR | OUT DATE | OUT USR | IN DATE | IN USR CY 20860023 | Movie name | ACTION | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860023 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 20860006 | Movie name | COMEDY | | | 1 | 1 | 0 | 1000 | -00-00 00:00:00 | -00-00 00:00:00 |0 Thanks for you help :) I appreciate it very much. Roman Neuhauser [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] # [EMAIL PROTECTED] / 2007-01-22 22:55:50 -0800: Jim Lucas [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $count = 0; while ( $row = mysql_fetch_array( $invlist ) ) { if ( $count % 1 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } echo HEREDOC tr bgcolor={$rowColor} td class='body'{$row['dvdId']/td td{$row['dvdTitle']}/td td class='body'{$row['dvdGenre']}/td td{$row['dvdGenre2']}/td td class='body'{$row['dvdGenre3']}/td td{$row['dvdActive']}/td td class='body'{$row['dvdOnHand']}/td td{$row['backordered']}/td td class='body'{$row['dvdHoldRequests']}/td td{$row['incomingInverntory']}/td td class='body'{$row['ogUserId']}/td td{$row['outDate']}/td td class='body'{$row['outUserId']}/td td{$row['inDate']}/td td class='body'{$row['inUserId']}/td td{$row['cycles']}/td /tr HEREDOC; $count++; echo '/tbody/table'; } } I don't understand how the quotient works there. I will sometime. I also don't understand the HEREDOC concept. I wanted colors alternating to allow for a better read. Ignore the heredoc thing, the quotient (remainder after division) works just like it worked in your math class, but it should be if ( $count % 2 ) { $rowColor = '#c1c1c1'; } else { $rowColor = ''; } Although I'd use $rowColors = array('', '#c1c1c1'); ... $rowColor = $rowColors[$count % 2]; I still have not solved the problem with listing the genre in its own row, alone at the beginning of each section of genre (the start of each unique genre which is the ORDER BY in the statement). Thanks for the code. I need to learn how to write more eloquently like you. If anyone can figure out the a row listing for the genres, that would be s cool. You want something like this? genre | #id | title | #id | title | #id | title ---+-+---+-+---+-+ horror | 123 | Scary Movie 1 | 456 | Scary Movie 2 | ... | comedy | 234 | Funny Movie 1 | 456 | Funny Movie 2 | ... | -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help With Inventory
Can anyone help me figure out how to solve my inventory listing problem? I am using php_5 and mysql_5.0 w/apache on fbsd. I need to figure out a way to make a subtitle for every category (genre) in the inventory so when I list the entire inventory on a sheet (at client's request), it is organized by category (genre) and each category (genre) has a title line above it. So the there is not just one big list rather a neat list with titles for each category THEN all the rows in that category etc. I can't figure out the loop to make the titles. I have them sorted as you can by genre, the list is formatted fine There are alternating colors on the rows to make it read easier. I just want to keep from having to make a statement for EACH genre. I will eventually make the genre list dynamic too, so I need to figure out how to dynamically generate this inventory list. This is the output I have now: DVD ID TITLE GENRE 1 GENRE 2 GENRE 3ACT QTY BCK HLDINC OG USR OUT DATE OUT USRIN DATE IN USR CY 20860003Movie name action 1 1 0 1000-00-00 00:00:00 -00-00 00:00:000 20860020Move Name COMEDY 11 0 1000 -00-00 00:00:00 -00-00 00:00:00 0 20860006Movie name COMEDY 1 1 0 1000-00-00 00:00:00 -00-00 00:00:000 What I WANT to see is: I will fix the background colors, I just want to see the GENRE: ACTION - 1 TITLES and GENRE: COMEDY - 2 TITLES DVD ID TITLE GENRE 1 GENRE 2 GENRE 3ACT QTY BCK HLDINC OG USR OUT DATE OUT USRIN DATE IN USR CY GENRE: ACTION - 1 TITLES 20860003Movie name ACTION 1 1 0 1000-00-00 00:00:00 -00-00 00:00:000 GENRE: COMEDY - 2 TITLES 20860023Movie name COMEDY1 1 0 1000 -00-00 00:00:00-00-00 00:00:00 0 20860006Movie name COMEDY 1 1 0 1000-00-00 00:00:00 -00-00 00:00:000 This is the code: 1. function invlistONE(){ 2. dbconnect('connect'); 3. $invlist = mysql_query(SELECT * FROM sp_dvd ORDER BY dvdGenre); 4. 5. 6. ? 7. table cellspacing=0 style=font-size:8pt; 8. tr 9. div style=font-size:8pt 10. td align=left class=bodybDVD ID/b/td 11. td align=left width=225bTITLE/b/td 12. td align=left class=body width=75bGENRE 1/b/td 13. td align=left width=75bGENRE 2/b/td 14. td align=left class=body width=75bGENRE 3/b/td 15. td align=left width=10bACT/b/td 16. td align=left class=body width=10bQTY/b/td 17. td align=left width=10bBCK/b/td 18. td align=left class=body width=10bHLD/b/td 19. td align=left width=10bINC/b/td 20. td align=left class=body width=50bOG USR/b/td 21. td align=leftbOUT DATE/b/td 22. td align=left class=body width=55bOUT USR/b/td 23. td align=leftbIN DATE/b/td 24. td align=left class=body width=50bIN USR/b/td 25. td align=left width=\10\bCY/b/td 26. /div 27. /tr 28. ? 29. 30. $count = 0; 31. while($row = mysql_fetch_array($invlist)){ 32. 33. $dvdId = $row['dvdId']; 34. $dvdGenre = $row['dvdGenre']; 35. $dvdGenre2 = $row['dvdGenre2']; 36. $dvdGenre3 = $row['dvdGenre3']; 37. $dvdTitle = $row['dvdTitle']; 38. $dvdOnHand = $row['dvdOnHand']; 39. $dvdOnHand = $row['dvdOnHand']; 40. 41. $active = $row['dvdActive']; 42. $back = $row['backordered']; 43. $hold = $row['dvdHoldRequests']; 44. $incoming = $row['incomingInventory']; 45. 46. $ogUserId = $row['ogUserId']; 47. $outDate = $row['outDate']; 48. $outUserId = $row['outUserId']; 49. $inDate = $row['inDate']; 50. $inUserId = $row['inUserId']; 51. $cycles = $row['cycles']; 52. $dvdLastUpdate = $row['dvdLastUpdate']; 53. $dvdLastAdminUpdate = $row['dvdLastAdminUpdate']; 54. 55. if ( $count == 1 ) { echo (tr bgcolor=\#c1c1c1\); } 56. else { echo (tr);} 57. 58. echo (div ); 59. echo (td class=\body\ align=\left\ $dvdId /td); 60. echo (td align=\left\ width=\225\$dvdTitle/td); 61. echo (td class=\body\ align=\left\ width=\75\$dvdGenre/td); 62. echo (td align=\left\ width=\75\$dvdGenre2/td); 63. echo (td class=\body\ align=\left\ width=\75\$dvdGenre3/td); 64. echo (td align=\left\ width=\10\$active/td); 65. echo (td class=\body\ align=\left\ width=\10\$dvdOnHand/td); 66. echo (td align=\left\ width=\10\$back/td); 67. echo (td class=\body\ align=\left\ width=\10\$hold/td); 68. echo (td align=\left\ width=\10\$incoming/td); 69. echo (td class=\body\ align=\left\ width=\50\$ogUserId/td); 70. echo (td align=\left\ width=\75\$outDate/td); 71. echo
[PHP] Help me about using php with tomcat server.
Dear all, I have two web application running on php and jsp. But i don't know how can to use php and jsp on tomcat server. Please help me. thanks best regard.
Re: [PHP] Help me about using php with tomcat server.
# [EMAIL PROTECTED] / 2007-01-04 15:05:54 +0700: I have two web application running on php and jsp. But i don't know how can to use php and jsp on tomcat server. Please help me. Find an implementation of PHP in Java (tough luck) or the official library wrapped in a JNI interface. But you'll make it a lot easier on yourself if you just install Apache with PHP beside the Tomcat. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me about using php with tomcat server.
Hi, The Tomcat server now includes the php javabridge, its a war file called JavaBridge.war. Also, you can find this war file in php-java-bridge.sourceforge.net . The instllation is pretty easy just copy the war file in the root directory (e.g webapps/) and then run it from the browser (eg. localhost/JavaBridge), Hope this helps Naved On 1/4/07, Le Phuoc Canh [EMAIL PROTECTED] wrote: Dear all, I have two web application running on php and jsp. But i don't know how can to use php and jsp on tomcat server. Please help me. thanks best regard.
Re: [PHP] Help me about detect client screen resolution!!!
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Just remember in web context is a server-side language ... so you couldn't have more information than client would want to send to you in web context, the navigator send some information to the server (like what navigator, address, proxy, ...) so ... has David show you, use javascript for example, and can your php which screen resolution : index.html: script type=text/javascript location.href=index.php?h=+screen.heigth+w= +screen.width; /script = it will redirect to your php script which $_GET['h'] = heigth client resolution, and $_GET['w'] = width client resolution have fun -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) - WinPT 1.0.1 iD8DBQFFm5XdEg3iyspSWPARAiwbAJ9bFE+m/oFAcka236Xnccjzb6YY/ACdFc8G FuH5WvpqWEEkhMK0cYHhvOc= =syLI -END PGP SIGNATURE-
[PHP] Help me about detect client screen resolution!!!
Can we use php to detect client screen resolution? Please help me ? Best Regard.
Re: [PHP] Help me about detect client screen resolution!!!
Le Phuoc Canh wrote: Can we use php to detect client screen resolution? Please help me ? No we can't. You need Javascript or another client-side technology for that. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help me about detect client screen resolution!!!
On 1/2/07, Stut [EMAIL PROTECTED] wrote: Le Phuoc Canh wrote: Can we use php to detect client screen resolution? Please help me ? No we can't. You need Javascript or another client-side technology for that. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php script type=text/javascript var thisSize; function showStats() { thisSize = 'Screen resolution is ' + screen.width + ' x ' + screen.height; if (thisSize) { document.getElementById(output).innerHTML = thisSize; } } /script html a href=javascript:showStats();Screen Resolution/a p id=output/p /html I think this should work. David
Re: [PHP] Help me about detect client screen resolution!!!
At 1/2/2007 12:24 AM, Le Phuoc Canh wrote: Can we use php to detect client screen resolution? Please help me ? Do you really want screen resolution or do you want browser window size? Not every PC user keeps their windows maximized, and I have yet to meet a Mac user who attempts to do so. For cross-browser javascript that measures the viewport, see Peter-Paul Koch's page: Viewport properties http://www.quirksmode.org/viewport/compatibility.html PHP and javascript can act in concert. If PHP doesn't yet know the monitor size, it can download a javascript-only page that will talk back, e.g.: document.location.href = '?width=' . x . 'height=' . y which PHP can receive as $_GET['x'] and $_GET['y'] and then use to download the desired page. Keep in mind that the user can change window size at any time and many people do so from one page to the next to accommodate varying content and their other desktop activities at the time. Therefore you can't really rely on intial measurements; if the proper rendering of your page DEPENDS on knowing the window size, you'll need to re-measure it for every pageview. Downloading a measuring script in advance of each web page would make the browsing experience a bit sluggish. If possible, try to make your page layouts more robust. There are many techniques for engineering pages to tolerate a wide spectrum of window widths; see the CSS-D wiki for links: http://css-discuss.incutio.com/ Regards, Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help with \n\r in strings
Hi all, I receive a text file with a whole bunch of strings. and each line is terminated by what I presume is \n\r however when I read the string into PHP, it seems that the last column of the row and the first column of the next row are connected but it appears as a space but I've done all kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is always empty. So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? Thanks in advance. Angelo -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with \n\r in strings
On Fri, 2006-12-29 at 11:42 +0200, Angelo Zanetti wrote: Hi all, I receive a text file with a whole bunch of strings. and each line is terminated by what I presume is \n\r however when I read the string into PHP, it seems that the last column of the row and the first column of the next row are connected but it appears as a space but I've done all kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is always empty. So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? Thanks in advance. strpos( $dateAmount, \n ) or strpos( $dateAmount, \r ) Double quotes are required for expansion of special characters. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help with \n\r in strings
Try: $string_as_array = explode(\n, $string); echo pre; print_r($string_as_array); echo /pre; The array that you get will contain segments of the string that is separated with \n. Let me know if that helps. Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 29, 2006 10:43 AM To: PHP List Subject: [PHP] help with \n\r in strings Hi all, I receive a text file with a whole bunch of strings. and each line is terminated by what I presume is \n\r however when I read the string into PHP, it seems that the last column of the row and the first column of the next row are connected but it appears as a space but I've done all kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is always empty. So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? Thanks in advance. Angelo -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- 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] help with \n\r in strings
If you just want to test for \n\r - if ( substr ( -2, $my_string ) == \n\r ) { // substr with the negative value of 2 will give you the last two characters of your string // do some stuff } I think it would be a good idea to explain a little bit more what you are trying to accomplish. Are you preparing the string for a database insert? Do you want to sanitise the string? Stripping off those kind of characters can also be done with trim (or ltrim - trims white space characters from the left of the string or rtim - trims from the right). Read the manual for more details and options. If you are not quite sure what those characters are, you can find out with this little helper. $characters = preg_split( '//', $my_string ); foreach ( $characters as $character ) { echo ASCI value of the character {$character} is: . ord ( $character ) . br /\n; } Then you can look up the values in a ASCI table. /frank 29 dec 2006 kl. 11.01 skrev Peter Lauri: Try: $string_as_array = explode(\n, $string); echo pre; print_r($string_as_array); echo /pre; The array that you get will contain segments of the string that is separated with \n. Let me know if that helps. Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Angelo Zanetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 29, 2006 10:43 AM To: PHP List Subject: [PHP] help with \n\r in strings Hi all, I receive a text file with a whole bunch of strings. and each line is terminated by what I presume is \n\r however when I read the string into PHP, it seems that the last column of the row and the first column of the next row are connected but it appears as a space but I've done all kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is always empty. So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? Thanks in advance. Angelo -- -- -- Angelo Zanetti Systems developer -- -- *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- 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: [PHP] help with \n\r in strings
On Fri, 2006-12-29 at 11:17 +0100, Frank Arensmeier wrote: If you just want to test for \n\r - if ( substr ( -2, $my_string ) == \n\r ) { // substr with the negative value of 2 will give you the last two characters of your string // do some stuff } You have your substr() parameters backwards. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with \n\r in strings
Angelo Zanetti wrote: So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? Since it's coming from a file, you might as well just read it with file(), which will split each line into an array automatically. If it's a CSV file, then fgetcsv() helps you out even more. Arpad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with \n\r in strings
2006/12/29, Arpad Ray [EMAIL PROTECTED]: Angelo Zanetti wrote: So is there a way to test for \r\n? or what else can I use to delimit these two values (last column of row and first column of next row)? mmm what about open the file with and hex editor?.. or mmm notepad++ have a option to see if is \r \n or \r\n hopes helps Since it's coming from a file, you might as well just read it with file(), which will split each line into an array automatically. If it's a CSV file, then fgetcsv() helps you out even more. Arpad -- 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] help with curl
Dear All, I have a script that uses curl to execute an http request now I use the same code for two different servers. And it works on the first server but not the second. I have stored the URL that it generates on the server that doesnt work and if I paste it into the address bar of the browser it works but somehow the script doesnt execute it. $ch = curl_init();// initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 8); // times out after 4s curl_setopt($ch, CURLOPT_GET, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $dat); // add POST curl_setopt($ch, CURLOPT_PORT, $port); // set POST method $result = curl_exec($ch); // run the whole process now is there anything that can be causing this not to execute? I have increasd the timeout to 8 seconds (is this enough). COuld there be a problem with the server not being able to execute a URL in that way? Is there anything else I can do to trouble shoot this? IF the URL is as follows: http://www.sdfsfjs.com?username=hellopassword=goodbye do I need to set the GET variable string seperately in the CURLOPT_POSTFIELDS or can I just send it as one string? Thanks in advance. regards -- Angelo Zanetti Systems developer *Telephone:* +27 (021) 469 1052 *Mobile:* +27 (0) 72 441 3355 *Fax:*+27 (0) 86 681 5885 * Web:* http://www.zlogic.co.za *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help with curlSOLVED
it appears the problem with the port and not the timeout. Angelo Zanetti wrote: Dear All, I have a script that uses curl to execute an http request now I use the same code for two different servers. And it works on the first server but not the second. I have stored the URL that it generates on the server that doesnt work and if I paste it into the address bar of the browser it works but somehow the script doesnt execute it. $ch = curl_init();// initialize curl handle curl_setopt($ch, CURLOPT_URL,$url); // set url to post to curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 8); // times out after 4s curl_setopt($ch, CURLOPT_GET, 1); // set POST method curl_setopt($ch, CURLOPT_POSTFIELDS, $dat); // add POST curl_setopt($ch, CURLOPT_PORT, $port); // set POST method $result = curl_exec($ch); // run the whole process now is there anything that can be causing this not to execute? I have increasd the timeout to 8 seconds (is this enough). COuld there be a problem with the server not being able to execute a URL in that way? Is there anything else I can do to trouble shoot this? IF the URL is as follows: http://www.sdfsfjs.com?username=hellopassword=goodbye do I need to set the GET variable string seperately in the CURLOPT_POSTFIELDS or can I just send it as one string? Thanks in advance. regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with strange include problem in PHP 5.2.0
Hi Richard, I think I've identified the problem. It appears to be a problem with PHPMyAdmin rather than PHP itself. The directory permissions we have are the minimum we need, usually 710, file permissions are 640. The group part of the permissions is how the apache gets to the files in the directories. This time I did the installation of PMA and changed all the directory and file permissions according to the standards here. As it turns out, PMA demands read permission on the directory in which it's distribution directory is installed. That is: /usr/local/htdocs# ls -la pma/ total 16 drwxr-x--- 4 root webservd 512 Dec 6 10:48 . drwxrwx--- 17 rootwebservd 2048 Dec 6 10:22 .. drwxr-xr-x 9 root webservd2048 Nov 30 14:06 phpMyAdmin-2.8.1 drwx--x--- 10 root webservd2560 Dec 1 12:36 phpMyAdmin-2.9.1.1-all-languages If the permission of this directory listed above has 710 instead of 750, PMA falls over! /usr/local/htdocs# ls -la pma/ total 16 drwx--x--- 4 root webservd 512 Dec 6 10:48 . drwxrwx--- 17 rootwebservd 2048 Dec 6 10:22 .. drwx--x--- 9 root webservd2048 Nov 30 14:06 phpMyAdmin-2.8.1 drwx--x--- 10 root webservd2560 Dec 1 12:36 phpMyAdmin-2.9.1.1-all-languages It took quite a bit of scratching my head until I found this out. In particular, PMA 2.9.1.1 really falls over with the 710 permissions that are currently set. I think now I need to file a PMA bug report. thanks for the suggestions you made, they did help me find this problem. regards Markus On Friday 01 December 2006 22:27, Richard Lynch wrote: Try running it under some kind of debugger and see if you can figure out what directories it's even checking when it doesn't find the file... I dunno if Zend IDE (or whatever it's called now) or Komodo or XDebug or whatnot will do that, but it's definitely sounding very odd if your include_path has . in it... Oooh... What does PHP think your cwd is? echo 'hr /cwd: ', cwd(), hr /\n; right before the include. On Fri, December 1, 2006 3:47 am, Markus Mayer wrote: Hi Richard, Hi all, The include path is correct. That was one of the first things I played around with. At the moment, it's include_path = .. I also tried renaming the php.ini file to php.ini.off so that it wasn't found and took all the defaults, but with no success. Last night I built PHP 5.1.6 and took the same php.ini file. Everything worked. The build environment was the same, the configure arguments were the same, only the php version was different. I'm guessing that I've done something wrong somewhere because I haven't found any references to this problem from any one else. I just have no idea what it could be. I don't know if it's any help in locating the problem, my build environment is Solaris 10, Sun Studio 10 with the Sun C and C++ compilers. # cc-V Sun C 5.7 2005/01/07 # CC -V CC: Sun C++ 5.7 2005/01/07 LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2 CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include And to your rant about the code developers make - I totally agree with you. As the administrator of a server with close to 600 users who all put their own applications in their own accounts up, then ask me why it doesn't work, I get annoyed at such things too. regards Markus On Thursday 30 November 2006 19:04, Richard Lynch wrote: On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: I have a strange problem including files in PHP 5.2.0 running on Unix. If I try to include a file using include 'filename.inc';, everything is fine. As soon as I try to put a . in front of the file name, for example include './filename.inc';, I get a failed to open stream: No such file or directory error. Does anyone have any suggestions as to what is going wrong?` This all works with php 4.4.4 built with the same environment and compiler on the same system. What is your include path in PHP 5.2.0? I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 include_path has . as one element within the list and that the PHP 5.2.0 include_path does NOT have . within the list. I.e.: 4.4.4 include_path .:include_test_dir 5.2.0 include_path include_test_dir In the first case, 4.4.4, you've got . in there, so . combined with ./ will find the file you want. In the second case, 5.2.0, you've got no . in there, so ./ is looking in a directory, not the directory you expect, and it ain't finding the file because it's not there. Rant #24, not
Re: [PHP] Help me about audio stream...
On Mon, December 4, 2006 1:37 am, Le Phuoc Canh wrote: Dears, I want to make a web app about music online. But i don't know how to use streaming in PHP to load a music file for playing. Please help me for the best direction. Thanks alot and best regard. You are making this too complicated. Fortunately, I've had to explain this to many many musicians in other forums, and can simplify it: Step #1. Create your MP3 somehow with a CD-ripper/encoder or whatever. Step #2. Upload the MP3 to your website, just like an HTML page, but be sure it uploads as BINARY and not ASCII Step #3. Test the uploaded file as a download. Just make a link to the MP3, the same way you'd link to an HTML page, only it will have somethine like somesong.mp3 in it. That should do a download for your MP3 player. If not, and it prompts you to save it as an unknown type, or shows a bunch of gibberish on the browser window, then you have to figure out how to convince your web-server that the correct mime-type for that file ending in .mp3 is: audio/mpeg Step #4. Copy/paste the URL to the MP3 into a plain text file. Not MS Word, nor even FrontPage nor DreamWeaver, but just plain old Notepad (SimpleText on the Mac). Save the file as somesong.m3u The .m3u is crucial for the file type. Step #5. Upload that .m3u file to your webserver, and make a link to THAT URL, just like you do for HTML files and just like you did in Step#2, only with the .m3u URL instead. Step #6. Test the .m3u link, and it should be a streaming audio file for your MP3 player. Again, if not, you have to convince your web-server that the correct mime-type for an .m3u file is: audio/mpeg-url That's it. You now have streaming audio on your server. None of this has anything to do with PHP, really, so some obligatory PHP comments are in order. :-) You can use a script like sample to sort of funnel requests for the MP3s and have that be a PHP script which keeps a log who played what, or it can do something fun like prepend the ID3 tags to the MP3 stream, so that your ID3 data can easily be changed without dinking around with monstrous MP3 files to edit them. Here is a sample script for that purpose, and more: http://uncommonground.com/sample.phps This script also has some stuff in it to upload the MP3 from a second tier server into a caching system, which you can mostly ignore. Or steal, as you see fit. YMMV -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help me about audio stream...
Dears, I want to make a web app about music online. But i don't know how to use streaming in PHP to load a music file for playing. Please help me for the best direction. Thanks alot and best regard.
Re: [PHP] Help with strange include problem in PHP 5.2.0
Hi Richard, Hi all, The include path is correct. That was one of the first things I played around with. At the moment, it's include_path = .. I also tried renaming the php.ini file to php.ini.off so that it wasn't found and took all the defaults, but with no success. Last night I built PHP 5.1.6 and took the same php.ini file. Everything worked. The build environment was the same, the configure arguments were the same, only the php version was different. I'm guessing that I've done something wrong somewhere because I haven't found any references to this problem from any one else. I just have no idea what it could be. I don't know if it's any help in locating the problem, my build environment is Solaris 10, Sun Studio 10 with the Sun C and C++ compilers. # cc-V Sun C 5.7 2005/01/07 # CC -V CC: Sun C++ 5.7 2005/01/07 LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2 CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include And to your rant about the code developers make - I totally agree with you. As the administrator of a server with close to 600 users who all put their own applications in their own accounts up, then ask me why it doesn't work, I get annoyed at such things too. regards Markus On Thursday 30 November 2006 19:04, Richard Lynch wrote: On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: I have a strange problem including files in PHP 5.2.0 running on Unix. If I try to include a file using include 'filename.inc';, everything is fine. As soon as I try to put a . in front of the file name, for example include './filename.inc';, I get a failed to open stream: No such file or directory error. Does anyone have any suggestions as to what is going wrong?` This all works with php 4.4.4 built with the same environment and compiler on the same system. What is your include path in PHP 5.2.0? I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 include_path has . as one element within the list and that the PHP 5.2.0 include_path does NOT have . within the list. I.e.: 4.4.4 include_path .:include_test_dir 5.2.0 include_path include_test_dir In the first case, 4.4.4, you've got . in there, so . combined with ./ will find the file you want. In the second case, 5.2.0, you've got no . in there, so ./ is looking in a directory, not the directory you expect, and it ain't finding the file because it's not there. Rant #24, not directed at Markus, but the world at large :-) PHP developers should understand and use include_path instead of hacking up their source with hard-coded paths and weird sub-directory / parent-directory hacks in include/require statements. It drives me nuts when I install nice software packages, but I can't put their components where I want them. End result: rm -rf [insert your nifty project directory name here] -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with strange include problem in PHP 5.2.0
On Thursday 30 November 2006 19:04, Richard Lynch wrote: [snip...] And of course I forgot to put in the configure arguments './configure' \ '--without-pear' \ '--with-apxs2=/usr/local/apache2/bin/apxs' \ '--enable-mm=shared' \ '--with-mysql=/usr/local/MySQL/mysql-standard-5.0.27-solaris10-sparc' \ '--with-ldap=/usr/local/open-ldap' \ '--with-openssl=/usr/sfw/' \ '--with-zlib' \ '--enable-inline-optimization' \ '--enable-mm=shared' \ '--with-libxml-dir=/usr/local/lib/libxml-2.6.27' \ '--with-oci8=/opt/oracle/instantclient_10_2' \ $@ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with strange include problem in PHP 5.2.0
Try running it under some kind of debugger and see if you can figure out what directories it's even checking when it doesn't find the file... I dunno if Zend IDE (or whatever it's called now) or Komodo or XDebug or whatnot will do that, but it's definitely sounding very odd if your include_path has . in it... Oooh... What does PHP think your cwd is? echo 'hr /cwd: ', cwd(), hr /\n; right before the include. On Fri, December 1, 2006 3:47 am, Markus Mayer wrote: Hi Richard, Hi all, The include path is correct. That was one of the first things I played around with. At the moment, it's include_path = .. I also tried renaming the php.ini file to php.ini.off so that it wasn't found and took all the defaults, but with no success. Last night I built PHP 5.1.6 and took the same php.ini file. Everything worked. The build environment was the same, the configure arguments were the same, only the php version was different. I'm guessing that I've done something wrong somewhere because I haven't found any references to this problem from any one else. I just have no idea what it could be. I don't know if it's any help in locating the problem, my build environment is Solaris 10, Sun Studio 10 with the Sun C and C++ compilers. # cc-V Sun C 5.7 2005/01/07 # CC -V CC: Sun C++ 5.7 2005/01/07 LDFLAGS=-L/opt/sfw/lib -L/usr/sfw/lib -L/usr/lib -R/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/opt/oracle/instantclient_10_2 CPPFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include CFLAGS=-I/opt/sfw/include -I/usr/sfw/include/openssl -I/usr/local/BerkeleyDB/include -I/usr/include -I/opt/oracle/instantclient_10_2/sdk/include And to your rant about the code developers make - I totally agree with you. As the administrator of a server with close to 600 users who all put their own applications in their own accounts up, then ask me why it doesn't work, I get annoyed at such things too. regards Markus On Thursday 30 November 2006 19:04, Richard Lynch wrote: On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: I have a strange problem including files in PHP 5.2.0 running on Unix. If I try to include a file using include 'filename.inc';, everything is fine. As soon as I try to put a . in front of the file name, for example include './filename.inc';, I get a failed to open stream: No such file or directory error. Does anyone have any suggestions as to what is going wrong?` This all works with php 4.4.4 built with the same environment and compiler on the same system. What is your include path in PHP 5.2.0? I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 include_path has . as one element within the list and that the PHP 5.2.0 include_path does NOT have . within the list. I.e.: 4.4.4 include_path .:include_test_dir 5.2.0 include_path include_test_dir In the first case, 4.4.4, you've got . in there, so . combined with ./ will find the file you want. In the second case, 5.2.0, you've got no . in there, so ./ is looking in a directory, not the directory you expect, and it ain't finding the file because it's not there. Rant #24, not directed at Markus, but the world at large :-) PHP developers should understand and use include_path instead of hacking up their source with hard-coded paths and weird sub-directory / parent-directory hacks in include/require statements. It drives me nuts when I install nice software packages, but I can't put their components where I want them. End result: rm -rf [insert your nifty project directory name here] -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with strange include problem in PHP 5.2.0
Hi all, I have a strange problem including files in PHP 5.2.0 running on Unix. If I try to include a file using include 'filename.inc';, everything is fine. As soon as I try to put a . in front of the file name, for example include './filename.inc';, I get a failed to open stream: No such file or directory error. Does anyone have any suggestions as to what is going wrong?` This all works with php 4.4.4 built with the same environment and compiler on the same system. thanks Markus The files I am testing are: include.php: ?php $result = include 'filename.inc'; echo Result of first include = $result; $result = include './filename.inc'; echo Result of second include = $result; $result = include './include_test_dir/filename.inc'; echo Result of third include = $result; ? filename.inc: ?php echo I am the included file...; ? # ls -l total 6 -rw-r--r-- 1 root webservd 44 Nov 30 13:45 filename.inc -rw-r--r-- 1 root webservd 265 Nov 30 13:45 include.php drwxr-sr-x 2 root webservd 512 Nov 30 13:44 include_test_dir # ls -l include_test_dir/ total 2 -rw-r--r-- 1 root webservd 21 Nov 30 13:45 filename.inc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with strange include problem in PHP 5.2.0
On Thu, November 30, 2006 6:49 am, Markus Mayer wrote: I have a strange problem including files in PHP 5.2.0 running on Unix. If I try to include a file using include 'filename.inc';, everything is fine. As soon as I try to put a . in front of the file name, for example include './filename.inc';, I get a failed to open stream: No such file or directory error. Does anyone have any suggestions as to what is going wrong?` This all works with php 4.4.4 built with the same environment and compiler on the same system. What is your include path in PHP 5.2.0? I'm going to go out on a limb and bet a dollar that the PHP 4.4.4 include_path has . as one element within the list and that the PHP 5.2.0 include_path does NOT have . within the list. I.e.: 4.4.4 include_path .:include_test_dir 5.2.0 include_path include_test_dir In the first case, 4.4.4, you've got . in there, so . combined with ./ will find the file you want. In the second case, 5.2.0, you've got no . in there, so ./ is looking in a directory, not the directory you expect, and it ain't finding the file because it's not there. Rant #24, not directed at Markus, but the world at large :-) PHP developers should understand and use include_path instead of hacking up their source with hard-coded paths and weird sub-directory / parent-directory hacks in include/require statements. It drives me nuts when I install nice software packages, but I can't put their components where I want them. End result: rm -rf [insert your nifty project directory name here] -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help! PRINTF Function
Hello, The following examples don't work printf([%10s]\n, $s); // justification à droite avec des espaces printf([%-10s]\n, $s); // justification à gauche avec des espaces but this one: printf([%'#10s]\n, $s); // utilisation du caractère personnalisé de séparation '#' is ok (with any separator) Source: http://ch2.php.net/manual/fr/function.sprintf.php Is it related to French characters set I used for displaying my page ? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html xmlns=http://www.w3.org/1999/xhtml; xml:lang=fr lang=fr Thanks for your advice N. TRUONG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help! PRINTF Function
On 06/11/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, The following examples don't work printf([%10s]\n, $s); // justification à droite avec des espaces printf([%-10s]\n, $s); // justification à gauche avec des espaces but this one: printf([%'#10s]\n, $s); // utilisation du caractère personnalisé de séparation '#' is ok (with any separator) Source: http://ch2.php.net/manual/fr/function.sprintf.php Is it related to French characters set I used for displaying my page ? We'd only know if you told us what doesn't work means. Do you get _any_ output? What? Error messages? Are you sure that you're using UTF-8 encoding? Dotan Cohen http://what-is-what.com/what_is/xml.html
Re: [PHP] Help! PRINTF Function
# [EMAIL PROTECTED] / 2006-11-06 12:46:14 +0100: Hello, The following examples don't work printf([%10s]\n, $s); // justification ? droite avec des espaces printf([%-10s]\n, $s); // justification ? gauche avec des espaces but this one: printf([%'#10s]\n, $s); // utilisation du caract?re personnalisé de séparation '#' is ok (with any separator) it works: [EMAIL PROTECTED] ~ 1003:0 php tmp/scratch [monkey] [monkey] [monkey] [monkey] [monkey] [many monke] [EMAIL PROTECTED] ~ 1004:0 Is it related to French characters set I used for displaying my page ? No, it's related to your browser replacing multiple whitespace characters with a single horizontal space. -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] help confirming a PDO_SQLITE bug
I've just upgraded to Fedora Core 6 and my personal site broke. Along with the upgrade came PHP 5.1.6 and SQLite 3.3.6. After the upgrade any SELECT returns all its values with the last character missing. I've filed a bug at pecl.php.net (http://pecl.php.net/bugs/bug.php?id=9191), but it doesn't look as though that's reviewed very often. I need help confirming that it is a PDO or SQLite bug so that I can begin upgrading or downgrading to avoid it. If you have matching versions of PHP and/or SQLite, can you try out the test script below and see if it's broken in the same way? Thanks, Rick Fletcher Reproduce code: --- ?php $dbh = new PDO( 'sqlite::memory:' ); $dbh-query( 'CREATE TABLE things ( name VARCHAR NOT NULL )'); $dbh-query( 'INSERT INTO things VALUES ( thing one )'); foreach( $dbh-query( 'SELECT * FROM things' ) as $row ) { print_r( $row ); } $dbh = null; ? Expected result: Array ( [name] = thing one [0] = thing one ) Actual result: -- Array ( [name] = thing on [0] = thing on ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help confirming a PDO_SQLITE bug
Thanks to anyone who entertained my previous email, but I've solved my own problem. It looks like the bug is in PDO_SQLITE 1.0.1. I've just compiled from that extension from CVS, changing nothing else, and the bug is gone. --rick Rick Fletcher wrote: I've just upgraded to Fedora Core 6 and my personal site broke. Along with the upgrade came PHP 5.1.6 and SQLite 3.3.6. After the upgrade any SELECT returns all its values with the last character missing. I've filed a bug at pecl.php.net (http://pecl.php.net/bugs/bug.php?id=9191), but it doesn't look as though that's reviewed very often. I need help confirming that it is a PDO or SQLite bug so that I can begin upgrading or downgrading to avoid it. If you have matching versions of PHP and/or SQLite, can you try out the test script below and see if it's broken in the same way? Thanks, Rick Fletcher Reproduce code: --- ?php $dbh = new PDO( 'sqlite::memory:' ); $dbh-query( 'CREATE TABLE things ( name VARCHAR NOT NULL )'); $dbh-query( 'INSERT INTO things VALUES ( thing one )'); foreach( $dbh-query( 'SELECT * FROM things' ) as $row ) { print_r( $row ); } $dbh = null; ? Expected result: Array ( [name] = thing one [0] = thing one ) Actual result: -- Array ( [name] = thing on [0] = thing on ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help, please! UTF-8 encoding problem
Hi, I would like some help with an encoding problem, please. I would like to encode some text (a news entry entered via a form, to be exact) into UTF-8 and then save it in an XML file for persistent storage. My problem is, some of the users are Japanese and would like to enter Japanese multi-byte characters. The following should work, I believe: // Open file if (!$handle = fopen($filename, wb)) { echo(Error! Cannot open file $filename); exit; } // Generate XML string $newsXML = ?xml version=\1.0\ encoding=\UTF-8\?\n; $newsXML .= newsItem\n; $newsXML .= headline.mb_convert_encoding($headline, UTF-8); $newsXML .= /headline\n; $newsXML .= maintext.mb_convert_encoding($maintext, UTF-8); $newsXML .= /maintext\n; $newsXML .= /newsItem\n; // Encode $newsXML = mb_convert_encoding($newsXML, UTF-8,auto); $encodedNewsXML = utf8_encode($newsXML); echo(p.mb_detect_encoding($encodedNewsXML)./p); echo(p.$encodedNewsXML./p); // Write news item content to the file if (fwrite($handle, $encodedNewsXML) == FALSE) { echo(Error! Could not write to file $filename); exit; } echo(Success, wrote news item to the file $filename); fclose($handle); ... but it doesn't! :-( Whenever I run this, it displays ASCII followed by the Japanese text characters (both kanji and kana). Note that the caharcters _are_ displayed correctly, although the encoding is detected as ASCII, which doesn't make sense to me. The script then happily proceeds to save in ASCII-format, and consequently, when the main script reads the saved file, it replaces all characters by . Other UTF-8 files, saved in an external editor such as Bluefish or GEdit _can_ be read correctly. The problem simply must be in the encoding. And before you ask, yes, mb_*** is supported in the PHP server. What am I doing wrong? Please let me know; I've been struggling a long time with this and will be very grateful for any assistance. Best regards, Jan This message was sent using IMP, the Internet Messaging Program. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects
On Thu, October 5, 2006 2:55 pm, Satyam wrote: - Original Message - From: Martin Alterisio To: Satyam Cc: Deckard ; php-general@lists.php.net You're wrong, partially: I am sure you could have stated that in a more courteous way. So, this Argentinian, Italian, and European walk into a mailing list... :-) :-) :-) Language constructs in English are probably not the best thing to flame about on this list... Back to the curly braces! {?php echo $var1: $var2?} Sorry. Couldn't resist. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects
On 10/5/06, Deckard [EMAIL PROTECTED] wrote: Hi, I'm trying to lay my hands on PHP OOP, but it's not easy :( I've read several examples in the web, but cannot transpose to may case. I'm trying to set a class to make SQL inserts in mysql. I commend you on trying to build an OOP class for database abstraction. Having already been there and done that, might I introduce you quickly to one of the great advantages of OOP: reuse. There are already many classes out there built to help accomplish database interaction. Yes it's an obvious place for OOP, but as your first foray into the discipline, I think you're biting off more than you can chew. Alternatively, why not download and start using one of the many stable and community-tested DB classes? Believe me, I completely relate to the need to build it myself, and I don't want to squash that (it's the best way to learn). I just don't think it's worth doing it for database interaction. It's just not beginner material, and it's something you'll be using in all of your code from here on out, so it's best to start with something stable... My $.02. Er, £.01. HTH, John W p.s. I'm sure you want suggestions of good DB classes to use. Ironically, I use my own, so I don't have extensive experience in others, but why not look at the Zend Framework (it's what I'm switching to)? No need to use the whole framework. Or others on the list will surely have their suggestions of classes to use... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects
On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Properties are very often nouns in addition to adjectives. For instance a linked list class will undoubtedly have noun objects referring to the current link, the next link, etc. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects
- Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Satyam [EMAIL PROTECTED] Cc: Deckard [EMAIL PROTECTED]; php-general@lists.php.net Sent: Thursday, October 05, 2006 2:16 AM Subject: Re: [PHP] Help on objects On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Properties are very often nouns in addition to adjectives. For instance a linked list class will undoubtedly have noun objects referring to the current link, the next link, etc. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] Help on objects [with reply]
i may be wrong, but your use of the class to me seems pointless... the reuse aspect of your database connection could be done with a simple include... maybe your need is different from what i suspect, being a beginner myself... here is what i do, and maybe the list can tell me if it would be better or worse for you... in a seperate php file define your database info... ?php //begin database information $hostname = localhost; $db_user = nerd_mysite; $db_pass = pepsi_is_good; $database = nerd__pepsi; $l = @mysql_connect($hostname, $db_user, $db_pass); @mysql_select_db($database, $l); //end database information ? and in the all of the files you would need this connection you would just include that file...and call the database with the variable $l. example: ? $nerdCheck = mysql_query(SELECT * FROM DrinkMorePepsi WHERE username = '$_POST[username]', $l) ? and this could easily be made into a function to allow for multiple databases, users passwords, ect if nothing else, at least tell me what you think about my way of doing this. - Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Satyam [EMAIL PROTECTED] Cc: Deckard [EMAIL PROTECTED]; php-general@lists.php.net Sent: Thursday, October 05, 2006 2:16 AM Subject: Re: [PHP] Help on objects On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Properties are very often nouns in addition to adjectives. For instance a linked list class will undoubtedly have noun objects referring to the current link, the next link, etc. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- 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] Help on objects [with reply]
Re the last suggestion, ensure you keep those database details outside the web root (ie in a file called connect.inc for example) or if have to keep it there add a .htaccess file that prevents download of *.inc files. Also, avoid use of the error suppression operator (@). You need to see your errors.
Re: [PHP] Help on objects [with reply]
yea, thanks for the input... but do you think my solution would be better for original poster? - Original Message - From: Dave Goodchild [EMAIL PROTECTED] To: benifactor [EMAIL PROTECTED] Cc: Robert Cummings [EMAIL PROTECTED]; Satyam [EMAIL PROTECTED]; Deckard [EMAIL PROTECTED]; php-general@lists.php.net Sent: Thursday, October 05, 2006 4:55 AM Subject: Re: [PHP] Help on objects [with reply] Re the last suggestion, ensure you keep those database details outside the web root (ie in a file called connect.inc for example) or if have to keep it there add a .htaccess file that prevents download of *.inc files. Also, avoid use of the error suppression operator (@). You need to see your errors. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects [with reply]
Undoubtedly. He could also use the PEAR DB abstraction layer.
Re: [PHP] Help on objects
2006/10/4, Deckard [EMAIL PROTECTED]: Hi, I'm trying to lay my hands on PHP OOP, but it's not easy :( I've read several examples in the web, but cannot transpose to may case. I'm trying to set a class to make SQL inserts in mysql. I have the class: - ?php class dBInsert { // global variables var $first; // constructor function dBInsert($table, $sql) { $this-table = $table; $this-sql = $sql; return(TRUE); } // function that constructs the sql and inserts it into the database function InsertDB($sql) { print($sql); // connect to MySQL $conn-debug=1; $conn = ADONewConnection('mysql'); $conn-PConnect('localhost', 'deckard', 'ble', 'wordlife'); if ($conn-Execute($sql) === false) print 'error inserting: '.$conn-ErrorMsg().'BR'; return (TRUE); } } and the code that calls it: ?php include_once(classes/dBInsert.php); $sql = INSERT INTO wl_admins VALUES ('',2); $dBInsert = new dBInsert('wl_admins', '$sql'); $dBInsert-InsertDB('$sql'); ? but it's not working ? Can anyone give me a hand here ? I've read the manuals, examples, etc. Any help would be appreciated. Best Regards, Deckard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php For database interaction, give PDO a chance: http://php.net/pdo IMO it's cleaner and more efficient than adodb. Then, I believe what you're trying to make is a query builder. I would break down the differente parts of an sql query and create abstractions for each part (some can be reused on different types of queries), then have builder create the queries abstractions from the different parts.
Re: [PHP] Help on objects
2006/10/5, Satyam [EMAIL PROTECTED]: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Satyam You're wrong, partially: an action can be an object and it's not necessarily a bad design, take for example function objects or the program and statements as objects in lisp-like languages. It's acceptable to make a class that works as an abstract representation of an sql query. This kind of classes are used very efficiently in object persistence libraries. What I agree with you is that it's not right that this class works as the insert action and not as a representation of the insert operation.
Re: [PHP] Help on objects
- Original Message - From: Robert Cummings [EMAIL PROTECTED] To: Satyam [EMAIL PROTECTED] Cc: Deckard [EMAIL PROTECTED]; php-general@lists.php.net Sent: Thursday, October 05, 2006 11:16 AM Subject: Re: [PHP] Help on objects On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Properties are very often nouns in addition to adjectives. For instance a linked list class will undoubtedly have noun objects referring to the current link, the next link, etc. Cheers, Rob. -- Indeed, they often are: you as an object are defined by properties such as height, color of your hair and many other adjectives and you have many other objects which define you, fingers, legs, etc, which are also properties. Being more detailed, instead of the color of your hair being a property of you as a whole, you might have a property pointing to a hair object (a noun) which has a color property. Other noun properties might not be so helpful in defining you, your friends might give a hint of who you are, your clients do not. But, after all, neither does your hair, mine is deserting me and I'm still myself. So, I would say that while adjectives define an object, nouns are relations in between objects and might not define neither. Anyway, I didn't mean this analogy to be complete, nor I mean to teach OOP to English teachers, and though it can be talked much about, stretching it too far would certainly break it. I don't mean to defend it very strongly. Cheers Satyam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help on objects
- Original Message - From: Martin Alterisio To: Satyam Cc: Deckard ; php-general@lists.php.net Sent: Thursday, October 05, 2006 3:50 PM Subject: Re: [PHP] Help on objects 2006/10/5, Satyam [EMAIL PROTECTED]: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Satyam You're wrong, partially: I am sure you could have stated that in a more courteous way.
Re: [PHP] Help on objects
2006/10/5, Satyam [EMAIL PROTECTED]: - Original Message - *From:* Martin Alterisio [EMAIL PROTECTED] *To:* Satyam [EMAIL PROTECTED] *Cc:* Deckard [EMAIL PROTECTED] ; php-general@lists.php.net *Sent:* Thursday, October 05, 2006 3:50 PM *Subject:* Re: [PHP] Help on objects 2006/10/5, Satyam [EMAIL PROTECTED]: I've seen you already had a good answer on the errors in the code so I won't go on that. As for OOP, the one design error you have is that you are asking for an action, not an object. You want to make SQL inserts, that is your purpose, and that is an action, which is solved by a statement, not by an object. There is no doer. Objects are what even your English teacher would call objects while describing a sentence. You are asking for a verb, you don't have a subject, you don't have an object. Of course you can wrap an action in a class, but that is bad design. Classes will usually have names representing nouns, methods will be verbs, properties adjectives, more or less, that's OOP for English teachers. Satyam You're wrong, partially: I am sure you could have stated that in a more courteous way. I apologize, english is not my first language and I usually can't express myself correctly. As a fellow compatriot I hope you'll understand there weren't ill intentions on what I said.
[PHP] Help on objects
Hi, I'm trying to lay my hands on PHP OOP, but it's not easy :( I've read several examples in the web, but cannot transpose to may case. I'm trying to set a class to make SQL inserts in mysql. I have the class: - ?php class dBInsert { // global variables var $first; // constructor function dBInsert($table, $sql) { $this-table = $table; $this-sql = $sql; return(TRUE); } // function that constructs the sql and inserts it into the database function InsertDB($sql) { print($sql); // connect to MySQL $conn-debug=1; $conn = ADONewConnection('mysql'); $conn-PConnect('localhost', 'deckard', 'ble', 'wordlife'); if ($conn-Execute($sql) === false) print 'error inserting: '.$conn-ErrorMsg().'BR'; return (TRUE); } } and the code that calls it: ?php include_once(classes/dBInsert.php); $sql = INSERT INTO wl_admins VALUES ('',2); $dBInsert = new dBInsert('wl_admins', '$sql'); $dBInsert-InsertDB('$sql'); ? but it's not working ? Can anyone give me a hand here ? I've read the manuals, examples, etc. Any help would be appreciated. Best Regards, Deckard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php