Re: [PHP] Apache Rewrite Issues
Hey Russell, After Going through all the threads in this post, it is correct to say, GET Rid of the space. Use - hyphen for SEO friendly URL's. Its completely OK. Other thing which is very handy is urlencode and urldecode functions. When you are sending a query string use urlencode function. This will preserve the query string variable as Test Story and not as just Test; even if there are spaces in the variable. Gaurav Kumar Tech Lead Open Source Solutions On Wed, Oct 7, 2009 at 4:22 PM, Russell Seymour russell.seym...@turtlesystems.co.uk wrote: Morning, I am trying to make my URLs more search engine friendly and I have come up against a problem. I want the following URL: mysite.example.com/articles/Test Story to be proxied to mysite.example.com/index.php?m=articlest=Test%20Story I have the following rule in my Apache conf RewriteRule ^/articles/(.*) index.php?m=articlest=$1 [P,L] Now if I run with this configuration, PHP strips the query string back at the space, so my query string ends up looking like [QUERY_STRING] = m=articlest=Test even though the log file for the rewrite shows that the full query is being passed. But if I change the RewriteRule to be a Rewrite instead of a Proxy I get [QUERY_STRING] = m=articlest=Test%20Story So something is happening when the system is proxying the request. Adding %20 into the URL does not fix the problem when proxy is enabled either. I have search around on the Internet, and people talk about using urlencode etc, this is fine when PHP is creating the URL but not when Apache is doing the rewrite. I apologise if people feel this is on the wrong list, but as far as I can tell from the rewrite logs the data is coming all the way through to PHP which is truncating it. This is purely my observation. Apache version: 2.2.11 PHP Version:5.3.0 Any help is gratefully recieved. Thanks, Russell
RE: [PHP] Insult my code!
Hi Paul, As I agree some of your thoughts, I want to add my opinion also. Yes the code should work. That is why we earn Money. If it doesnt work, then we are on fire. But things like OOP or MVC weren't invented for a better running code. They are invented so the codes will going to be much more clean, readable, reusable, maintainable. Running codes is not enough. Eric asked about how his MVC structure looks. And we are trying to help what we know about MVC. He didn't asked if the code is fine for running. So giving an answer The real key is, does it work, and can it be maintained is not enough and not really helpful to him on MVC concept. If you need just a running and maintainable project, you don't need to use MVC (MVC is not all about that). We are not criticizing his code(the code is really fine(except injection problem :-) ) and very readable) Eric, As Martin said, All the business logic should be in Model. Controller should not tell a model Save it to this database, select it from this table, use this db_adapter etc. A controller is like a maestro of the system. It askes the model to play piano loud. But it wont say which key of piano, the model should touch. I suggest you to read this online book about Zend Framework and MVC. Its really really very helpful to understand the concept. Also example codes are very clean and good. http://www.survivethedeepend.com/zendframeworkbook/en/1.0 Take Care, Mert (sorry for my english) -Original Message- From: Paul M Foster [mailto:pa...@quillandmouse.com] Sent: Wednesday, October 07, 2009 7:54 PM To: php-general@lists.php.net Subject: Re: [PHP] Insult my code! On Wed, Oct 07, 2009 at 05:34:35PM +1100, Eric Bauman wrote: Hi there, I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to implement a super-tiny MVC framework. I've created some mockups of how the framework might be used based around a very simple 'bank', but I'm trying to get some feedback before I go and implement it, to make sure I'm actually on the right track. Any thoughts would be much appreciated! Model - http://www.pastebin.cz/23595 Controller - http://www.pastebin.cz/23597 View - http://www.pastebin.cz/23598 Template - http://www.pastebin.cz/23599 Your code (what there is of it) is fine. Beware of people who criticize your code on purely academic criteria. There are a lot of differing opinions about MVC, much of it driven by people making academic points versus people who actually code for a living. Even some people who actually code for a living fall under the spell of academic rules about this or that. The real key is, does it work, and can it be maintained. If so, don't worry about people who argue esoteric points about what should or shouldn't be in models and controllers, etc. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Bu mesaj ve ekleri, mesajda g?nderildi?i belirtilen ki?i/ki?ilere ?zeldir ve gizlidir. Size yanl??l?kla ula?m??sa l?tfen g?nderen kisiyi bilgilendiriniz ve mesaj? sisteminizden siliniz. Mesaj ve eklerinin i?eri?i ile ilgili olarak ?irketimizin herhangi bir hukuki sorumlulu?u bulunmamaktad?r. ?irketimiz mesaj?n ve bilgilerinin size de?i?ikli?e u?rayarak veya ge? ula?mas?ndan, b?t?nl???n?n ve gizlili?inin korunamamas?ndan, vir?s i?ermesinden ve bilgisayar sisteminize verebilece?i herhangi bir zarardan sorumlu tutulamaz. This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what is php4 popularity?
Hey guys, does anyone have a good link for an article where php4 popularity trends are examined? The best way for me to know php4 % and php5 %. I appreciate any good suggestions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
On Wed, 2009-10-07 at 13:24 -0700, Tommy Pham wrote: From: tedd tedd.sperl...@gmail.com To: php-general@lists.php.net; a...@ashleysheridan.co.uk; Daevid Vincent dae...@daevid.com Sent: Wed, October 7, 2009 12:42:41 PM Subject: RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo At 1:59 PM +0100 10/7/09, Ashley Sheridan wrote: On Wed, 2009-10-07 at 08:54 -0400, tedd wrote: At 6:15 PM -0700 10/6/09, Daevid Vincent wrote: Except that: $a = 123; $b = $a++; echo $b; //gives 123, not 124 as you logically expect it to and common sense would dictate, regardless of what KR or anyone else says. That's not the way I look at it. $b = $a++; means to me take the value of $a and assign to $b and then increment $a. Whereas: $b = ++$a; means to me increment $a and take the value of $a and assign to $b. Cheers, tedd Which is exactly the reason for the two operators in C. Thanks, Ash Ash: The reason was simply to provide a different way of doing something. For example, take the statements of: $a = 10; $b = a$++; // $b = 10 and $a = 11 This post-increment operator was a way to assign 10 to $b and increment $a in one statement. Whereas: $a = 10; $b = ++a$;// $b = 11 and $a = 11 This pre-increment operator was a way to increment $a and also assign that value to $b. Both are perfectly valid ways of using the operator. Also realize that the pre-decrement and post-decrement operators worked in similar fashion. Now why would someone want to do that? There could be many reasons, but that was left to the programmer to use as he/she needed. However, what I find wacky about all of this is: for($i=1; $i=10; $i++) { echo($i); } and for($i=1; $i=10; ++$i) { echo($i); } Do exactly the same thing. I would have expected the first to print 1-10, while the second to print 2-10, but they both print 1-10. Cheers, tedd Tommy Why would expect to print 2-10? The way I read the for loop is: start $i with 1, do loop body until $i = 10, increment $i before next loop. So whether post/pre-increment doesn't matter logically. Moreover, your loop can also be written as: for ($i=1; $i = 10;) { echo ($i++); } PS: I hate to send reply in 'rich text' but Yahoo's plain text screw up the quote... I think it's time to switch over to gmail... -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php That what I thought I said when I said Which is exactly the reason for the two operators in C. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Apache Rewrite Issues
On Wed, 2009-10-07 at 16:49 -0400, Paul M Foster wrote: On Wed, Oct 07, 2009 at 11:52:00AM +0100, Russell Seymour wrote: Morning, I am trying to make my URLs more search engine friendly and I have come up against a problem. I want the following URL: mysite.example.com/articles/Test Story to be proxied to mysite.example.com/index.php?m=articlest=Test%20Story Aside from the solution to your problem (which I don't have), you might want to double-check on the search engine friendliness of URLs which contain query strings. I know at one time this was the case, but the latest I've heard is that URLs like your second one above are completely okay with search engines. If someone else knows different, please speak up. And oh by the way, don't *ever* store a filename with a space in it on your computer. It's Evil(tm). I curse the idiot who first came up with allowing this in filenames. I have a special voodoo doll just for that person, when I find them. As you can see, it causes all manner of odd problems, no matter what OS it's on. (My local LUG list is periodically hit with messages from people trying to overcome the problems attendant to this habit.) Paul -- Paul M. Foster I do a lot of research into SEO, and the only evidence I've found that comes close to this is where a website set up a page containing a fictional keyword in the URL, then searched for that word a week or two later. I don't know how valid the 'SEO friendly URLs' are though. How often have you searched for the answer to a question online and had the top few results turn out to be forums with dynamic query-string URLs?! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Insult my code!
On 8/10/2009 1:20 AM, Andrea Giammarchi wrote: So far I stopped at the first line, the constructor, where I can spot with what I can read SQL injections everywhere I hope here is a proper validation there, 'cause as is, sounds truly dangerous, since you are not using bindParams or other PDO related techniques to avoid input problems. About the rest I kinda agree with the proper model controller, rather than just a reader. Regards To: php-general@lists.php.net Date: Wed, 7 Oct 2009 17:34:35 +1100 From: baum...@livejournal.dk Subject: [PHP] Insult my code! Hi there, I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to implement a super-tiny MVC framework. I've created some mockups of how the framework might be used based around a very simple 'bank', but I'm trying to get some feedback before I go and implement it, to make sure I'm actually on the right track. Any thoughts would be much appreciated! Model - http://www.pastebin.cz/23595 Controller - http://www.pastebin.cz/23597 View - http://www.pastebin.cz/23598 Template - http://www.pastebin.cz/23599 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Windows Live: Friends get your Flickr, Yelp, and Digg updates when they e-mail you. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010 The linked code was supposed to be more of a mockup than anything, with the functions a bit of filler to try and show what I'm trying to do. With regard to the SQL injection, I try not to make the problems with my code quite so blatant. :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: what is php4 popularity?
On 8/10/2009 4:28 PM, Paul M. wrote: Hey guys, does anyone have a good link for an article where php4 popularity trends are examined? The best way for me to know php4 % and php5 %. I appreciate any good suggestions. Here's a pretty graph comparing PHP version usage and time: http://www.nexen.net/images/stories/phpversion/200810/evolution.milieu.png Source (French): http://www.nexen.net/chiffres_cles/phpversion/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Insult my code!
On 8/10/2009 5:18 PM, Mert Oztekin wrote: Hi Paul, As I agree some of your thoughts, I want to add my opinion also. Yes the code should work. That is why we earn Money. If it doesnt work, then we are on fire. But things like OOP or MVC weren't invented for a better running code. They are invented so the codes will going to be much more clean, readable, reusable, maintainable. Running codes is not enough. Eric asked about how his MVC structure looks. And we are trying to help what we know about MVC. He didn't asked if the code is fine for running. So giving an answer The real key is, does it work, and can it be maintained is not enough and not really helpful to him on MVC concept. If you need just a running and maintainable project, you don't need to use MVC (MVC is not all about that). We are not criticizing his code(the code is really fine(except injection problem :-) ) and very readable) Eric, As Martin said, All the business logic should be in Model. Controller should not tell a model Save it to this database, select it from this table, use this db_adapter etc. A controller is like a maestro of the system. It askes the model to play piano loud. But it wont say which key of piano, the model should touch. I suggest you to read this online book about Zend Framework and MVC. Its really really very helpful to understand the concept. Also example codes are very clean and good. http://www.survivethedeepend.com/zendframeworkbook/en/1.0 Take Care, Mert (sorry for my english) Thanks for the link, it looks like an interesting read. Hopefully it will help me understand MVC better and hence allow me to improve my code design. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] avoid Denial of Service
Hi everybody! I want to get some tips about how avoid a attack of Denial of service. May be somebody can about your experience with Php o some configuration of apache, o other software that help in these case. Thanks in advance. -- Gerardo Benitez
Re: [PHP] avoid Denial of Service
Not sure what exactly you are looking for. Anyways, some common practice are request for API key, username / password tokens before providing access to a service. Thanks, Gaurav Kumar On Thu, Oct 8, 2009 at 7:06 PM, Gerardo Benitez gerardobeni...@gmail.comwrote: Hi everybody! I want to get some tips about how avoid a attack of Denial of service. May be somebody can about your experience with Php o some configuration of apache, o other software that help in these case. Thanks in advance. -- Gerardo Benitez
Re: [PHP] avoid Denial of Service
On Thu, 2009-10-08 at 19:40 +0530, Gaurav Kumar wrote: Not sure what exactly you are looking for. Anyways, some common practice are request for API key, username / password tokens before providing access to a service. Thanks, Gaurav Kumar On Thu, Oct 8, 2009 at 7:06 PM, Gerardo Benitez gerardobeni...@gmail.comwrote: Hi everybody! I want to get some tips about how avoid a attack of Denial of service. May be somebody can about your experience with Php o some configuration of apache, o other software that help in these case. Thanks in advance. -- Gerardo Benitez If you are using Apache there are a bunch of different DoS modules that you can use: http://www.google.co.uk/search?q=apache +dosie=utf-8oe=utf-8aq=trls=org.mozilla:en-US:officialclient=firefox-a Also, if you are in full control of the server, you may be able to configure firewalls for this sort of thing. It gets more complex when you're attacked with a DDoS (Distributed Denial of Service) as there's no real hard-and-fast way to prevent them, as they could genuinely be legitimate requests to your server and not attacks. As a distributed attack comes from many sources, you can't reliably differentiate the valid requests from the malicious ones. Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Re: what is php4 popularity?
Eric Bauman wrote: On 8/10/2009 4:28 PM, Paul M. wrote: Hey guys, does anyone have a good link for an article where php4 popularity trends are examined? The best way for me to know php4 % and php5 %. I appreciate any good suggestions. Here's a pretty graph comparing PHP version usage and time: http://www.nexen.net/images/stories/phpversion/200810/evolution.milieu.png Source (French): http://www.nexen.net/chiffres_cles/phpversion/ This research is done on October 2008. Does anyone has newer research? And thanks Eric! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML RSS - Unexpected End of File error
Hi guys, I've knocked up a quick RSS feed on my site. It works fine in Fx 2 3, in Opera it throws an error unexpected end of file but allows the feed to be added anyway, and Chrome just says there's an XML error, and gives the second from last line as the one containing the error. I tried adding a newline to the end of the file, but that just makes the error message report the next line. Any ideas where I'm going wrong? The file is using utf-8 character encoding. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] XML RSS - Unexpected End of File error
Can you show the generated XML? Jonathan On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Hi guys, I've knocked up a quick RSS feed on my site. It works fine in Fx 2 3, in Opera it throws an error unexpected end of file but allows the feed to be added anyway, and Chrome just says there's an XML error, and gives the second from last line as the one containing the error. I tried adding a newline to the end of the file, but that just makes the error message report the next line. Any ideas where I'm going wrong? The file is using utf-8 character encoding. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML RSS - Unexpected End of File error
On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote: Can you show the generated XML? Jonathan On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Hi guys, I've knocked up a quick RSS feed on my site. It works fine in Fx 2 3, in Opera it throws an error unexpected end of file but allows the feed to be added anyway, and Chrome just says there's an XML error, and gives the second from last line as the one containing the error. I tried adding a newline to the end of the file, but that just makes the error message report the next line. Any ideas where I'm going wrong? The file is using utf-8 character encoding. Thanks, Ash http://www.ashleysheridan.co.uk Nevermind, I was having a moment! I'd forgotten to close the final tag, as I mistook the root rss tag for an XML declaration instead! I am a little surprised that Fx allowed it to validate correctly though! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] XML RSS - Unexpected End of File error
Ashley Sheridan wrote: On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote: Can you show the generated XML? Jonathan On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Hi guys, I've knocked up a quick RSS feed on my site. It works fine in Fx 2 3, in Opera it throws an error unexpected end of file but allows the feed to be added anyway, and Chrome just says there's an XML error, and gives the second from last line as the one containing the error. I tried adding a newline to the end of the file, but that just makes the error message report the next line. Any ideas where I'm going wrong? The file is using utf-8 character encoding. Thanks, Ash http://www.ashleysheridan.co.uk Nevermind, I was having a moment! I'd forgotten to close the final tag, as I mistook the root rss tag for an XML declaration instead! I am a little surprised that Fx allowed it to validate correctly though! Thanks, Ash http://www.ashleysheridan.co.uk Well, don't forget, Fx will correct SGML and HTML that is missing tags. I think Fx would rather simply accept the incorrect format, correct it (since it wasn't a fatal error), and finally display what it figures you /intended/ to send it. I hate it when software tries to assume what I meant to say... :-( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML RSS - Unexpected End of File error
On Thu, 2009-10-08 at 12:50 -0700, Jim Lucas wrote: Ashley Sheridan wrote: On Thu, 2009-10-08 at 15:54 -0300, Jonathan Tapicer wrote: Can you show the generated XML? Jonathan On Thu, Oct 8, 2009 at 3:45 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Hi guys, I've knocked up a quick RSS feed on my site. It works fine in Fx 2 3, in Opera it throws an error unexpected end of file but allows the feed to be added anyway, and Chrome just says there's an XML error, and gives the second from last line as the one containing the error. I tried adding a newline to the end of the file, but that just makes the error message report the next line. Any ideas where I'm going wrong? The file is using utf-8 character encoding. Thanks, Ash http://www.ashleysheridan.co.uk Nevermind, I was having a moment! I'd forgotten to close the final tag, as I mistook the root rss tag for an XML declaration instead! I am a little surprised that Fx allowed it to validate correctly though! Thanks, Ash http://www.ashleysheridan.co.uk Well, don't forget, Fx will correct SGML and HTML that is missing tags. I think Fx would rather simply accept the incorrect format, correct it (since it wasn't a fatal error), and finally display what it figures you /intended/ to send it. I hate it when software tries to assume what I meant to say... :-( I'm just used to it letting me know if I was trying to view malformed XML. It must be a special case for RSS as it recognises the format as being special! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Newbie: Array of objects iteration
Hello all, I'm grabbing all records from a table using: $records = $stmt-fetchAll(PDO::FETCH_OBJ); return $records; In order to display the values we can do: foreach ($records as $record) { echo $record-id; echo $record-name; } However, I'd like to grab, also, the *column names*. I've tried: foreach ($records as $column=$value) { echo $column is $value\n; } But I get: Catchable fatal error: Object of class stdClass could not be converted to string Can I have your help on how can I properly get the column values? Regards, Márcio -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newb question about getting keys/values from a single array element
I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot, [2345] = banana, ... } where the user then refines it by choosing one single item and a single element array is returned like this: Array { [8575] = peach, } How can I get this $item so I can print it like so: echo The ID is $id and the name is $name; Normally with an array of items, I do a: foreach ($item as $id = $name) echo... But that seems overkill for this scenario. The rub is that I don't know the id, so I can't use $item[0], and I also don't have something like $item['name'] to use either. There's got to be an easy way to extract those. list($id, $name) = $operator; Felt like it would work for a minute (wishful thinking). (I'm too embarrased to even sign my name on this one) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newb question about getting keys/values from a single array element
One possible solution: ?php $a = array(8575 = 'peach'); list($id, $name) = array_merge(array_keys($a), array_values($a)); echo The ID is $id and the name is $name; ? Prints: The ID is 8575 and the name is peach. Regards, Jonathan On Thu, Oct 8, 2009 at 10:08 PM, Daevid Vincent dae...@daevid.com wrote: I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot, [2345] = banana, ... } where the user then refines it by choosing one single item and a single element array is returned like this: Array { [8575] = peach, } How can I get this $item so I can print it like so: echo The ID is $id and the name is $name; Normally with an array of items, I do a: foreach ($item as $id = $name) echo... But that seems overkill for this scenario. The rub is that I don't know the id, so I can't use $item[0], and I also don't have something like $item['name'] to use either. There's got to be an easy way to extract those. list($id, $name) = $operator; Felt like it would work for a minute (wishful thinking). (I'm too embarrased to even sign my name on this one) -- 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] Newb question about getting keys/values from a single array element
On Thu, Oct 08, 2009 at 06:08:48PM -0700, Daevid Vincent wrote: I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] = apple, [6342] = apricot, [2345] = banana, ... } where the user then refines it by choosing one single item and a single element array is returned like this: Array { [8575] = peach, } How can I get this $item so I can print it like so: echo The ID is $id and the name is $name; Normally with an array of items, I do a: foreach ($item as $id = $name) echo... But that seems overkill for this scenario. The rub is that I don't know the id, so I can't use $item[0], and I also don't have something like $item['name'] to use either. There's got to be an easy way to extract those. list($id, $name) = $operator; Felt like it would work for a minute (wishful thinking). If you don't know the index, then you really have no choice but to iterate through the POST array (if I understand you correctly). One problem I see is that you're using an integer for your index. The way I normally do things like this is to provide a prefix for the index. Like this: $items = array('fruit_1233' = 'apple', 'fruit_6342' = 'apricot', 'fruit_2345' = 'banana', 'fruit_8575' = 'peach'); Then, out of all the POST members returned, I can pick out the ones pertaining to fruit by simply looking for ones which have the 'fruit_' prefix as their index. It tends to be clunky, but it's the only way I've found to make it work: $fruits = get_fruits_from_table(); foreach ($fruits as $key = $value) { $index = 'fruit_' . $key; if (isset($_POST[$index])) { echo The user wants fruit #$key, $value.; } } Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Native support to MS SQL Server
Hello, Will we ever see drivers for MS SQL Server in PHP5? I know MS is working on drivers for PHP 5.3 but it's not clear if they will ever produce a PDO driver for PHP. PDO is the way to go. The other thing is that MS latest version of the sqlsrv driver requires SQL Native Client 2008 and is not compatible with previous versions of the client. This means that client will have to either install or upgrade their version SQL Client. It would be great if the driver did not require an addition software package to be installed. The lack of MSSQL support has cause developers to search the web (sometimes in vain) looking for driver support. This often times resulted in an alternative programming languages been chosen for the project.
RE: [PHP] Native support to MS SQL Server
Yes correct it will work on old version -Original Message- From: Raymond Irving [mailto:xwis...@yahoo.com] Sent: Friday, October 09, 2009 9:56 AM To: php-general@lists.php.net Subject: [PHP] Native support to MS SQL Server Hello, Will we ever see drivers for MS SQL Server in PHP5? I know MS is working on drivers for PHP 5.3 but it's not clear if they will ever produce a PDO driver for PHP. PDO is the way to go. The other thing is that MS latest version of the sqlsrv driver requires SQL Native Client 2008 and is not compatible with previous versions of the client. This means that client will have to either install or upgrade their version SQL Client. It would be great if the driver did not require an addition software package to be installed. The lack of MSSQL support has cause developers to search the web (sometimes in vain) looking for driver support. This often times resulted in an alternative programming languages been chosen for the project. --- Print this mail only if absolutely necessary. Save Paper. Save Trees. This e-mail message may contain confidential, proprietary or legally privileged information. It should not be used by anyone who is not the original intended recipient. If you have erroneously received this message, please delete it immediately and notify the sender. The recipient acknowledges that ICICI Bank or its subsidiaries and associated companies, (collectively ICICI Group), are unable to exercise control or ensure or guarantee the integrity of/over the contents of the information contained in e-mail transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of ICICI Group. Before opening any attachments please check them for viruses and defects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Correct handling _POST[] and implode. PHP5
Hi all, I have a form that has has an array of information. Mulitple checkboxes can be selected. Choose the colors: input type=checkbox name=Colors[] value=green checked=checked / Green input type=checkbox name=Colors[] value=yellow / Yellow input type=checkbox name=Colors[] value=red / Red input type=checkbox name=Colors[] value=gray / Gray When processing the form.. echo $_POST['Colors'] . 'br /'; // outputs 'Array' if ( isset($_POST['Colors']) ) { $_POST['Colors'] = implode(', ', $_POST['Colors']); //Converts an array into a single string } echo Colors you chose: {$_POST['Colors']}br /; I get the following error when using the implode function. Warning: implode() [function.implode]: Bad arguments What I doing wrong ? Thanks in advance. -- View this message in context: http://www.nabble.com/Correct-handling-_POST---and-implode.-PHP5-tp25815789p25815789.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php