[PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
Hi there, I am doing an application that allows me to create RSS channels and put feeds inside of each channel. Everything works so far, but - now I have started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete Feed' functionalities and have run into a problem. For me its a big problem cause Im not a guru programmer but for you out there it may be a piece of cake. I have the following line of code: $myFeedHTML .= " $feedItemImagePath DELETE"; In $myFeedHTML I'am always appending new HTML data to it, in this case I'am appending a table row/header row that has an image in it and underneath the image it has two buttons, one is for the EDIT functionality and the other is for the DELETE functionality. Now... notice the onClik events -> onClik='javascript:DeleteChannelAndAllOfItsFeeds()'. I ususally use that method to call a javascript function from within a button or a linkand like this is works (on its own - ie when its not being appended as a normal string to the variable $myFeedHTML). But...When it is appended to a variable so that I echo everything at once in the end, the onClik action must be included inside a " (double quotes) and inside ' (single quotes) so that it can be appeneded to the string, now when this is being done everything gets mixed because of of all the " and ' thus the program thinks that these are normal escape characters and just skips over the javascript call function that is nested within the onClik event. So the onClik is not getting a function assigned to it. (you can see this in the code I've pasted above) What can I do in order to append it to my $myFeedHTML variable and at the same time have it assigend a javascript function inside of its EDIT/DELETE button onClik event ? Can you give me some example maybe etc ? Image Preview: http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg btw: I know I've written onClik wrong but I wrote it this way in this forum cause it wouldn't let me post my thread because it regards it as an illegal tag lol. B-)B-) Thank you very much :) , The Ace -- View this message in context: http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.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
RE: [PHP] RE: Help with my first recursion menu
From: Lex Braun [mailto:lex.br...@gmail.com] Sent: segunda-feira, 2 de Novembro de 2009 02:58 To: MEM Cc: php-general@lists.php.net Subject: Re: [PHP] RE: Help with my first recursion menu Hi, On Sat, Oct 31, 2009 at 11:07 AM, MEM wrote: From: Lex Braun [mailto:lex.br...@gmail.com] Sent: sábado, 31 de Outubro de 2009 14:05 To: MEM Cc: php-general@lists.php.net Subject: Re: [PHP] RE: Help with my first recursion menu Hi, On Wed, Oct 28, 2009 at 5:22 PM, MEM wrote: I've been told that stack is the way to go, so I'm trying to understand the following code: http://pastebin.com/m5616c88f I've commented every line so that any of you could see if I'm interpreting something wrong: I have two questions about this code, that hopefully someone on the list could explain: 1) Why do we need to remove the last array item? (on line 32): array_pop($urlStack); On line 20, $url creates an URL path that includes the $cat path. Once you've completed iteration on all children of $cat, the url path should no longer include $cat path, thus it is removed from $urlStack. 2) Why we print the closed tag of the li element, after the recursive call? (on line 29) echo "\n"; Line 29 is closing the li element that was opened on line 23 for $cat. Thanks a lot in advance, Márcio -Lex Thanks a lot. I knew that: “Line 29 is closing the li element that was opened on line 23 for $cat.” My question intend to be more like: Why that line to close the li element is *after* the recursive call? Somehow, it seems that instead of creating something like this: item1 item2 item3 We are doing: item1 item2 item3 Say you have a tree menu that contains : $arr = array('item1' => 'Item 1', 'item2' => array('item2a' => 'Item 2a', 'item2b' => 'Item 2b')); $urlStack = array('category'); When you call the tree() function with the above $arr values, the function acts as follows: 1. First time through the function, the opening ul element is printed 2. First time through the foreach loop sets $cat = 'item1' and $val = 'Item 1'. 3. As this is not an array, the else condition prints Item 1 4. Second time through the foreach loop sets $cat = 'Item 2' and $val = array('item2a' => 'Item 2a', 'item2b' => 'Item 2b'). 5. As this is an array, the if condition prints Item and calls the tree function recursively 6. Second time through the tree function, another element is printed and the two sub items are printed as sub item as they do not contain additional arrays. Tree function ends by printing the closing tag. 7. The foreach loop from step 5 continues and prints the closing . Tree function ends by printing the closing tag. The output from calling tree($arr, $urlStack) would thus be: Item 1 Item 2 Item 2a Item 2b Perfectly clear. Thanks a lot Lex. :)
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
Hey, You can do it this way as well $myFeedHTML .= " $feedItemImagePath > DeleteChannelAndAllOfItsFeeds()\" /> />DELETE"; So you can escape double quotes by \ (slash) try this .. It will work... you can escape any special character that you want to use as it is by prepend it by \ On Mon, Nov 2, 2009 at 2:23 PM, acetrader wrote: > > Hi there, > > I am doing an application that allows me to create RSS channels and put > feeds inside of each channel. Everything works so far, but - now I have > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete > Feed' functionalities and have run into a problem. For me its a big problem > cause Im not a guru programmer but for you out there it may be a piece of > cake. > > I have the following line of code: > > $myFeedHTML .= " $feedItemImagePath > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> />DELETE"; > > In $myFeedHTML I'am always appending new HTML data to it, in this case I'am > appending a table row/header row that has an image in it and underneath the > image it has two buttons, one is for the EDIT functionality and the other > is > for the DELETE functionality. > > Now... notice the onClik events -> > onClik='javascript:DeleteChannelAndAllOfItsFeeds()'. I ususally use > that > method to call a javascript function from within a button or a linkand > like this is works (on its own - ie when its not being appended as a normal > string to the variable $myFeedHTML). > > But...When it is appended to a variable so that I echo everything at once > in > the end, the onClik action must be included inside a " (double quotes) and > inside ' (single quotes) so that it can be appeneded to the string, now > when this is being done everything gets mixed because of of all the " and ' > thus the program thinks that these are normal escape characters and just > skips over the javascript call function that is nested within the onClik > event. So the onClik is not getting a function assigned to it. (you can see > this in the code I've pasted above) > > What can I do in order to append it to my $myFeedHTML variable and at the > same time have it assigend a javascript function inside of its EDIT/DELETE > button onClik event ? > > Can you give me some example maybe etc ? > > Image Preview: > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) > > Thank you very much :) , > The Ace > > > -- > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.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 > > -- Devendra Jadhav
Re: [PHP] Re: Converting tables into forms
Bastien Koert wrote: > On Wed, Oct 28, 2009 at 8:53 AM, Bob McConnell wrote: >> From: Ashley Sheridan >> >>> On Tue, 2009-10-27 at 21:07 -0700, ben...@gmail.com wrote: >>> I am trying to take MySQL tables and use the table structure to >> create HTML/PHP forms in as few steps as possible for further development. I have a project that has hundreds of tables and requires hundreds of forms to be created and don't want to do so field by field by hand. On Tuesday, October 27, 2009, Allen McCabe >> wrote: > Please explain with much greater detail. > > On Tue, Oct 27, 2009 at 6:12 PM, ben...@gmail.com >> wrote: > Does anyone have a quick way of converting tables into forms? > >>> >>> There is still the issue of exactly what db fields will translate >> into. >>> Where is a good time to use radio buttons instead of select lists, or >>> checkboxes instead of select-multiple lists? What about text fields in >>> the db? Should they be textareas or text inputs? Do all the db fields >>> need to be translated as visible fields? Should you hide ID fields? >>> >>> There are so many questions, that you might be better off rolling your >>> own, as a one-size-fits-all will not always work for everyone. >> >> I have a feeling in the pit of my stomach that your project is going to >> create a support nightmare. Either you will have to hand code forms for >> each table, or find a framework that dynamically creates the forms from >> schema and create suitable maps for each form. In either case, it will >> take weeks or months to complete and be nearly impossible to maintain >> when tables are changed or added. >> >> If your solution requires you to create hundreds of forms, which could >> take months to code, you need to take another look at the problem. I >> don't believe you have thought it through very well. >> >> Bob McConnell >> >> -- >> PHP General Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > symfony might be another option, but it will take you some time to > sort out the yaml config. > > Recent versions of symfony (at least >= 1.0) can create the schema.yml from an existing database structure or a .sql file. Cheers -- David Robley This building is so high, the elevator shows movies. Today is Sweetmorn, the 14th day of The Aftermath in the YOLD 3175. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > Hi there, > > I am doing an application that allows me to create RSS channels and put > feeds inside of each channel. Everything works so far, but - now I have > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete > Feed' functionalities and have run into a problem. For me its a big problem > cause Im not a guru programmer but for you out there it may be a piece of > cake. > > I have the following line of code: > > $myFeedHTML .=" $feedItemImagePath > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> />DELETE"; > > In $myFeedHTML I'am always appending new HTML data to it, in this case I'am > appending a table row/header row that has an image in it and underneath the > image it has two buttons, one is for the EDIT functionality and the other is > for the DELETE functionality. > > Now... notice the onClik events -> > onClik='javascript:DeleteChannelAndAllOfItsFeeds()'. I ususally use that > method to call a javascript function from within a button or a linkand > like this is works (on its own - ie when its not being appended as a normal > string to the variable $myFeedHTML). > > But...When it is appended to a variable so that I echo everything at once in > the end, the onClik action must be included inside a " (double quotes) and > inside ' (single quotes) so that it can be appeneded to the string, now > when this is being done everything gets mixed because of of all the " and ' > thus the program thinks that these are normal escape characters and just > skips over the javascript call function that is nested within the onClik > event. So the onClik is not getting a function assigned to it. (you can see > this in the code I've pasted above) > > What can I do in order to append it to my $myFeedHTML variable and at the > same time have it assigend a javascript function inside of its EDIT/DELETE > button onClik event ? > > Can you give me some example maybe etc ? > > Image Preview: > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) > > Thank you very much :) , > The Ace > > > -- > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > Sent from the PHP - General mailing list archive at Nabble.com. > > I've noticed also that in your code you've always referred to onclik, when it should be onclick. I hope this was just a typo in the email! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
2009/11/2 Ashley Sheridan : > On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > >> Hi there, >> >> I am doing an application that allows me to create RSS channels and put >> feeds inside of each channel. Everything works so far, but - now I have >> started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and 'Delete >> Feed' functionalities and have run into a problem. For me its a big problem >> cause Im not a guru programmer but for you out there it may be a piece of >> cake. >> >> I have the following line of code: >> >> $myFeedHTML .= " $feedItemImagePath >> >> > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> > />DELETE"; >> >> In $myFeedHTML I'am always appending new HTML data to it, in this case I'am >> appending a table row/header row that has an image in it and underneath the >> image it has two buttons, one is for the EDIT functionality and the other is >> for the DELETE functionality. >> >> Now... notice the onClik events -> >> onClik='javascript:DeleteChannelAndAllOfItsFeeds()' . I ususally use that >> method to call a javascript function from within a button or a linkand >> like this is works (on its own - ie when its not being appended as a normal >> string to the variable $myFeedHTML). >> >> But...When it is appended to a variable so that I echo everything at once in >> the end, the onClik action must be included inside a " (double quotes) and >> inside ' (single quotes) so that it can be appeneded to the string, now >> when this is being done everything gets mixed because of of all the " and ' >> thus the program thinks that these are normal escape characters and just >> skips over the javascript call function that is nested within the onClik >> event. So the onClik is not getting a function assigned to it. (you can see >> this in the code I've pasted above) >> >> What can I do in order to append it to my $myFeedHTML variable and at the >> same time have it assigend a javascript function inside of its EDIT/DELETE >> button onClik event ? >> >> Can you give me some example maybe etc ? >> >> Image Preview: >> >> http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg >> >> btw: I know I've written onClik wrong but I wrote it this way in this forum >> cause it wouldn't let me post my thread because it regards it as an illegal >> tag lol. B-)B-) >> >> Thank you very much :) , >> The Ace >> >> >> -- >> View this message in context: >> http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html >> Sent from the PHP - General mailing list archive at Nabble.com. >> >> > > > I've noticed also that in your code you've always referred to onclik, > when it should be onclick. I hope this was just a typo in the email! I've noticed also that you didn't read his email properly. I hope that was just an oversight. -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
Ashley Sheridan: > btw: I know I've written onClik wrong but I wrote it this way in this forum > cause it wouldn't let me post my thread because it regards it as an illegal > tag lol. B-)B-) :D On Mon, Nov 2, 2009 at 4:38 PM, Ashley Sheridan wrote: > On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > > > Hi there, > > > > I am doing an application that allows me to create RSS channels and put > > feeds inside of each channel. Everything works so far, but - now I have > > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and > 'Delete > > Feed' functionalities and have run into a problem. For me its a big > problem > > cause Im not a guru programmer but for you out there it may be a piece of > > cake. > > > > I have the following line of code: > > > > $myFeedHTML .=" > $feedItemImagePath > > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> > />DELETE"; > > > > In $myFeedHTML I'am always appending new HTML data to it, in this case > I'am > > appending a table row/header row that has an image in it and underneath > the > > image it has two buttons, one is for the EDIT functionality and the other > is > > for the DELETE functionality. > > > > Now... notice the onClik events -> > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()'. I ususally use > that > > method to call a javascript function from within a button or a > linkand > > like this is works (on its own - ie when its not being appended as a > normal > > string to the variable $myFeedHTML). > > > > But...When it is appended to a variable so that I echo everything at once > in > > the end, the onClik action must be included inside a " (double quotes) > and > > inside ' (single quotes) so that it can be appeneded to the string, now > > when this is being done everything gets mixed because of of all the " and > ' > > thus the program thinks that these are normal escape characters and just > > skips over the javascript call function that is nested within the onClik > > event. So the onClik is not getting a function assigned to it. (you can > see > > this in the code I've pasted above) > > > > What can I do in order to append it to my $myFeedHTML variable and at the > > same time have it assigend a javascript function inside of its > EDIT/DELETE > > button onClik event ? > > > > Can you give me some example maybe etc ? > > > > Image Preview: > > > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > > > btw: I know I've written onClik wrong but I wrote it this way in this > forum > > cause it wouldn't let me post my thread because it regards it as an > illegal > > tag lol. B-)B-) > > > > Thank you very much :) , > > The Ace > > > > > > -- > > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > > Sent from the PHP - General mailing list archive at Nabble.com. > > > > > > > I've noticed also that in your code you've always referred to onclik, > when it should be onclick. I hope this was just a typo in the email! > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > -- Devendra Jadhav
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
On Mon, 2009-11-02 at 16:51 +0530, Devendra Jadhav wrote: > Ashley Sheridan: > > btw: I know I've written onClik wrong but I wrote it this way in this > forum > > cause it wouldn't let me post my thread because it regards it as an > illegal > > tag lol. B-)B-) > > :D > > > On Mon, Nov 2, 2009 at 4:38 PM, Ashley Sheridan > wrote: > > > On Mon, 2009-11-02 at 00:53 -0800, acetrader wrote: > > > > > Hi there, > > > > > > I am doing an application that allows me to create RSS channels and put > > > feeds inside of each channel. Everything works so far, but - now I have > > > started to do the 'Edit Channel', 'Edit Feed', 'Delete Channel' and > > 'Delete > > > Feed' functionalities and have run into a problem. For me its a big > > problem > > > cause Im not a guru programmer but for you out there it may be a piece of > > > cake. > > > > > > I have the following line of code: > > > > > > $myFeedHTML .=" > > $feedItemImagePath > > > > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()' /> > > />DELETE"; > > > > > > In $myFeedHTML I'am always appending new HTML data to it, in this case > > I'am > > > appending a table row/header row that has an image in it and underneath > > the > > > image it has two buttons, one is for the EDIT functionality and the other > > is > > > for the DELETE functionality. > > > > > > Now... notice the onClik events -> > > > onClik='javascript:DeleteChannelAndAllOfItsFeeds()'. I ususally use > > that > > > method to call a javascript function from within a button or a > > linkand > > > like this is works (on its own - ie when its not being appended as a > > normal > > > string to the variable $myFeedHTML). > > > > > > But...When it is appended to a variable so that I echo everything at once > > in > > > the end, the onClik action must be included inside a " (double quotes) > > and > > > inside ' (single quotes) so that it can be appeneded to the string, now > > > when this is being done everything gets mixed because of of all the " and > > ' > > > thus the program thinks that these are normal escape characters and just > > > skips over the javascript call function that is nested within the onClik > > > event. So the onClik is not getting a function assigned to it. (you can > > see > > > this in the code I've pasted above) > > > > > > What can I do in order to append it to my $myFeedHTML variable and at the > > > same time have it assigend a javascript function inside of its > > EDIT/DELETE > > > button onClik event ? > > > > > > Can you give me some example maybe etc ? > > > > > > Image Preview: > > > > > > http://old.nabble.com/file/p26156627/my%2BEscape%2BProblem.jpg > > > > > > btw: I know I've written onClik wrong but I wrote it this way in this > > forum > > > cause it wouldn't let me post my thread because it regards it as an > > illegal > > > tag lol. B-)B-) > > > > > > Thank you very much :) , > > > The Ace > > > > > > > > > -- > > > View this message in context: > > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156627.html > > > Sent from the PHP - General mailing list archive at Nabble.com. > > > > > > > > > > > > I've noticed also that in your code you've always referred to onclik, > > when it should be onclick. I hope this was just a typo in the email! > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > > > > oops, lol! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
lol thank you very much guys :) the escape character worked and now its accepting my javascript functions, thank you all very much :) :jumping::jumping: -- View this message in context: http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156680.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
Re: [PHP] PHP and Javascript escape character problem, --> those who like to solve things can try to solve this issue, its tricky I think ;)
:) On Mon, Nov 2, 2009 at 4:56 PM, acetrader wrote: > > lol thank you very much guys :) the escape character worked and now its > accepting my javascript functions, thank you all very much :) > :jumping::jumping: > -- > View this message in context: > http://old.nabble.com/PHP-and-Javascript-escape-character-problem%2C---%3E-those-who-like-to-solve-things-can-try-to-solve-this-issue%2C-its-tricky-I-think--%29-tp26156627p26156680.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 > > -- Devendra Jadhav
Re: [PHP] Classes and Functions
On Sun, Nov 1, 2009 at 6:46 PM, Larry Garfield wrote: > On Sunday 01 November 2009 2:50:55 pm Daniel Kolbo wrote: > > Hello, > > > > Is there a way to see what objects and functions a script > > loaded/required/used? > > > > I could recursively loop through the globals, but if objects were unset, > > then i may miss some. > > > > I could make a 'tracking' object and every time i load/include a file > > (which contains a class def or a function def) to add that file to the > > tracking object...but it would be nice if i didn't have to modify my > > existing code to see which objects and functions a script actually used, > > or at least, requested and loaded into memory. > > > > Thanks in advance, > > Daniel Kolbo > > ` > > Depends what you are trying to do with it, but I suspect these are a good > start: > > http://www.php.net/get_defined_functions > http://www.php.net/get_defined_vars > http://www.php.net/get_defined_constants > http://www.php.net/get_declared_classes > http://www.php.net/get_declared_interfaces > http://www.php.net/get_included_files > > -- > Larry Garfield > la...@garfieldtech.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > You can use the tokenizer's functions to parse the files and recover the information. They are easy to understand and make the perfect tool for this kind of scenario. I'd like to know how do you solve this. cheers -- Martin Scotta
[PHP] Re: What PHP version are you using?
Israel Ekpo wrote: > Hi Guys, > > I just want to conduct a quick survey to find out what version of PHP > people are using in their production environments. A few days late to answer perhaps, but in case you still want another reply: I use 5.2.6, the version that comes with Debian "Lenny". I do not usually install anything from outside the official Debian archives, makes my life much easier this way. [..] > I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 > and newer. That would make sense for us Debian users at least, as explained above. Other distros I'm not sure about. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What PHP version are you using?
On Mon, Nov 2, 2009 at 12:21 PM, O. Lavell wrote: > Israel Ekpo wrote: > > > Hi Guys, > > > > I just want to conduct a quick survey to find out what version of PHP > > people are using in their production environments. > > A few days late to answer perhaps, but in case you still want another > reply: I use 5.2.6, the version that comes with Debian "Lenny". I do not > usually install anything from outside the official Debian archives, makes > my life much easier this way. > > [..] > > > I cannot go below 5.2.0 though but I am thinking about starting at 5.2.4 > > and newer. > > That would make sense for us Debian users at least, as explained above. > Other distros I'm not sure about. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Thanks. I am still looking for responses. So you are not late. I just finishing testing against 5.2.10 down to 5.2.4. I am not sure how many people are still using versions between 5.2.0 and 5.2.3 I would like to know those ones too -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
Re: [PHP] Re: What PHP version are you using?
On Mon, Nov 2, 2009 at 2:29 PM, Israel Ekpo wrote: > On Mon, Nov 2, 2009 at 12:21 PM, O. Lavell wrote: > > > Israel Ekpo wrote: > > > > > Hi Guys, > > > > > > I just want to conduct a quick survey to find out what version of PHP > > > people are using in their production environments. > > > > A few days late to answer perhaps, but in case you still want another > > reply: I use 5.2.6, the version that comes with Debian "Lenny". I do not > > usually install anything from outside the official Debian archives, makes > > my life much easier this way. > > > > [..] > > > > > I cannot go below 5.2.0 though but I am thinking about starting at > 5.2.4 > > > and newer. > > > > That would make sense for us Debian users at least, as explained above. > > Other distros I'm not sure about. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > Thanks. > > I am still looking for responses. So you are not late. > > I just finishing testing against 5.2.10 down to 5.2.4. I am not sure how > many people are still using versions between 5.2.0 and 5.2.3 > > I would like to know those ones too > > -- > "Good Enough" is not good enough. > To give anything less than your best is to sacrifice the gift. > Quality First. Measure Twice. Cut Once. > Hi! I develop for 4.3.10 and 5.2.6 at work. At home I use 5.2.9, it was installed by xubuntu Our hosting providers have 5.2.0 or 5.2.4 -- Martin Scotta
Re: [PHP] Re: What PHP version are you using?
Israel Ekpo wrote: I just finishing testing against 5.2.10 down to 5.2.4. I am not sure how many people are still using versions between 5.2.0 and 5.2.3 I would like to know those ones too Well anybody running CentOS 5 or RedHat Linux Enterprise 5 using the official repo will be using PHP 5.1.x so you might want to thing twice about going any higher then that. -- John Insanity in individuals is something rare - but in groups, parties, nations and epochs, it is the rule. [Friedrich Nietzsche] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: What PHP version are you using?
From: John Black > Israel Ekpo wrote: >> I just finishing testing against 5.2.10 down to 5.2.4. I am not sure how >> many people are still using versions between 5.2.0 and 5.2.3 >> I would like to know those ones too > > Well anybody running CentOS 5 or RedHat Linux Enterprise 5 using the > official repo will be using PHP 5.1.x so you might want to thing twice > about going any higher then that. I just checked the Red Hat 5.4 manifest and it shows php-5.1.6-23.el5 - php-5.1.6-23.2.el5_3. CentOS simply repackages the Red Hat kit without the proprietary bits. I don't understand why they are so far behind on a build that was just released last month, but our hosting service only provides what's in the official release. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What PHP version are you using?
Bob McConnell wrote: I just checked the Red Hat 5.4 manifest and it shows php-5.1.6-23.el5 - php-5.1.6-23.2.el5_3. CentOS simply repackages the Red Hat kit without the proprietary bits. I don't understand why they are so far behind on a build that was just released last month, but our hosting service only provides what's in the official release. I just check the CentOS repo and the repo lists php-5.1.6-23.2.el5_3.x86_64.rpm as latest. So CentOS is as upto date as RedHat, the way it should be. -- John Define: Ubuntard => The drivel this guy spews is inane and forgettable stuff, characterized by comments that treat Ubuntu as if it is the only distribution in existence. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What PHP version are you using?
On Mon, Nov 2, 2009 at 2:15 PM, John Black wrote: > Bob McConnell wrote: > >> I just checked the Red Hat 5.4 manifest and it shows php-5.1.6-23.el5 - >> php-5.1.6-23.2.el5_3. CentOS simply repackages the Red Hat kit without >> the proprietary bits. I don't understand why they are so far behind on a >> build that was just released last month, but our hosting service only >> provides what's in the official release. >> > > I just check the CentOS repo and the repo lists > php-5.1.6-23.2.el5_3.x86_64.rpm as latest. > So CentOS is as upto date as RedHat, the way it should be. > > -- > John > Define: Ubuntard => The drivel this guy spews is inane and forgettable > stuff, characterized by comments that treat Ubuntu as if it is the only > distribution in existence. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > That is not good. 5.1.6 was released in August 2006. More than 3 years ago. There are a lot of bug fixes since then http://www.php.net/ChangeLog-5.php It looks like the php libraries are not maintained in CentOS and Red Hat Repositories. -- "Good Enough" is not good enough. To give anything less than your best is to sacrifice the gift. Quality First. Measure Twice. Cut Once.
Re: [PHP] Re: What PHP version are you using?
Israel Ekpo wrote: That is not good. 5.1.6 was released in August 2006. More than 3 years ago. There are a lot of bug fixes since then http://www.php.net/ChangeLog-5.php It looks like the php libraries are not maintained in CentOS and Red Hat Repositories. I posted the current RHEL version because, personally, I would look at the latest release of one of the biggest Enterprise class Linux vendors before deciding on a PHP version. The larger distros only tend to upgrade packages when required because other packages need them or when a security issues has been discovered. Other times they will patch in security fixes applied to packages. The tradeoff here is that you get something older but the system you receive is solid. I run ARCH Linux on my home system because I like to test the latest releases BUT I want stable software on my servers. -- John They hurt you at home and they hit you at school, They hate you if you're clever and they despise a fool, Till you're so fucking crazy you can't follow their rules... [John Lennon] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: What PHP version are you using?
Israel Ekpo wrote: On Mon, Nov 2, 2009 at 2:15 PM, John Black wrote: Bob McConnell wrote: I just checked the Red Hat 5.4 manifest and it shows php-5.1.6-23.el5 - php-5.1.6-23.2.el5_3. CentOS simply repackages the Red Hat kit without the proprietary bits. I don't understand why they are so far behind on a build that was just released last month, but our hosting service only provides what's in the official release. I just check the CentOS repo and the repo lists php-5.1.6-23.2.el5_3.x86_64.rpm as latest. So CentOS is as upto date as RedHat, the way it should be. That is not good. 5.1.6 was released in August 2006. More than 3 years ago. There are a lot of bug fixes since then http://www.php.net/ChangeLog-5.php It looks like the php libraries are not maintained in CentOS and Red Hat Repositories. There are very good reasons why a 'long time supported' build does not keep replacing packages all the time. It is gauranteed NOT to change them, so compatibility problems introduced by PHP such as the 'date' problem will not come up and bit ANY of their customers. I believe that there is a new version due on a couple of 'long time supported' distributions, but the current 'instability' with PHP5.3 potentially requiring changes to deployed applications is the sort of thing that these builds are supposed to avoid. I'll be staying with 5.2.x for a while simply because I know that is stable with my current code base. So it IS good that a stable and understood build of PHP is used as no one would gaurantee that later builds will not introduce problems - especially following a change of minor versions. -- Lester Caine - G8HFL - Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Custom function for inserting values into MySQL
Okay friends, I have been wondering about writing a simple function that will help me with my MySQL inserting. Not because I need to save time and space, but because I wanted to. I wrote a function for inserting 10 values (I have not been able to come up with an idea how to make the number of values I'm inserting variable, so I'm sticking with ten). This function takes 22 parameters: #1 is the table name, #2-21 are the row names and the values, and #22 is the "integar string". The first 21 parameters are self-explanatory, the 22nd is a string of values that need to be inserted as an integar, basically, not adding single quotes around the value. Eg. $value2 = 5, not $value2 = '5'. I am very hesitant to try this one out on my database, I've got tables of important information and don't want to, I don't know, inadvertantly throw a wrench into the works, AND I want to open up a dialoug about custom PHP functions for working with MySQL, for the fun of it! Here is my 10 value function for inserting data into a MySQL database table. function insertinto10($table, $field1, $value1, $field2, $value2, $field3, $value3, $field4, $value4, $field5, $value5, $field6, $value6, $field7, $value7, $field8, $value8, $field9, $value9, $field10, $value10, $int = NULL) { if (isset($int)) { $sPattern = '/\s*/m'; $sReplace = ''; $int = preg_replace($sPattern, $sReplace, $int); $pieces = explode(",", $int); // $pieces[0], $pieces[1] - each equal to value numbers that are integars $length = count($pieces); // call custom function to create associative array eg. $newarray[2] = 1, $newarray[4] = 1, $newarray[5] = 1 . . . $integarArray = strtoarray($length, $int); } $valuesArray = array($value1, $value2, $value3, $value4, $value5, $value6, $value7, $value8, $value9, $value10); foreach ($valuesArray as $key => $value) { if (isset($integarArray[$key]) && $integarArray[$key] == 1) { // INTEGAR VALUE $valuesArray[$key] = mysql_real_escape_string(stripslashes($value)); } else { // STRING VALUE $cleanValue = mysql_real_escape_string(stripslashes($value)); $valuesArray[$key] = "'{$cleanValue}'"; } } $result = mysql_query("INSERT INTO `{$table}` (`{$field1}`, `{$field2}`, `{$field3}`, `{$field4}`) VALUES ({$valuesArray[1]}, {$valuesArray[2]}, {$valuesArray[3]}, {$valuesArray[4]}, {$valuesArray[5]}, {$valuesArray[6]}, {$valuesArray[7]}, {$valuesArray[8]}, {$valuesArray[9]}, {$valuesArray[10]})"); return $result; } You may find copying/pasting into your favorite code-editor helps make it more readable. Do you see any major hangups or screwups on first glance? And is my fear of trying this out on my database unfounded? Does this even seem that useful?
RE: [PHP] Custom function for inserting values into MySQL
> Do you see any major hangups or screwups on first glance? Yes. There is so much wrong with this I don't even know where to begin... > This function takes 22 parameters: #1 is the table name, > #2-21 are the row > names and the values, and #22 is the "integar string". Dude. Seriously? TWENTY TWO parameters. Use this for variable number of parameters: http://us2.php.net/manual/en/function.func-get-args.php Or how about using an array/hash as your second parameter with the field=>value pairs. Which is astonishing since you have the concept of an array with this hack: $valuesArray = array($value1, $value2, $value3, $value4, $value5, $value6, $value7, $value8, $value9, $value10); foreach ($valuesArray as $key => $value) The word you're looking for is "INTEGER" not "INTEGAR". > And is my fear of trying this out on my database unfounded? No. Don't use it. > Does this even seem that useful? No. Your function is so very limited in scope and use. You're better off writing a wrapper around the SQL functions and submit direct SQL as the string parameter to the function. See attached db.inc.php. You would also be better served using a method/function such as my base.class.php::sync() which will insert or update a row. The attached code is about a year old or so and has since been refined further, but this should give you a good place to start. http://daevid.com _stamp; } function set_stamp($stamp) { $this->_stamp = $stamp; } /** * Constructor * * @access public * @return object * @parammixed $id the ID of the object to load from the database (this could be a string or usually an integer) * @author Daevid Vincent [dae...@] * @version 1.2 * @date 09/20/07 */ function __construct($id = NULL) { if ($_SESSION['companydb']) $this->db = $_SESSION['companydb']; //this follows the Ruby way for ease of porting/sharring, please stick with the convention. if (is_null($this->table) && preg_match( '/y$/', $this->getClassname() ) > 0) $this->table = strtolower(preg_replace( '/y$/', 'ies', $this->getClassName() )); elseif( is_null( $this->table ) ) $this->table = strtolower($this->getClassName()).'s'; if (!is_null($id)) $this->load($id); } /** * generate a key/value pair from the class' variables. * * @access public * @return array * @author Daevid Vincent [dae...@] * @version 1.0 * @date 08/13/07 */ public function get_array() { $row = array(); foreach($this as $key => $value) $row[$key] = $value; $row['enabled'] = ($this->enabled) ? 1 : 0; return $row; } /** * set the class' values based upon a SQL query. * * Note: Usually this is called by an extension class, * which in turn calls the parent::load_from_sql() * which generates an array and then calls load_from_array() * * @access public * @return array or false * @paramint $id ID of the object to load * @author Daevid Vincent [dae...@] * @version 1.0 * @date 08/20/07 * @see load_from_array() */ function load($id = null) { if (intval($id) < 1) return false; $sql = "SELECT * FROM".$this->db.".".$this->table." WHERE id = '".SQL_ESCAPE($id)."'"; $result = $this->load_from_sql($sql); //LIMIT 1 is appended by base class if ($result) return $result; else throw new Exception(translate('%1$s threw an exception trying to load object #%2$s', __CLASS__, $id)); } /** * set the class' values based upon a SQL table which is converted to an array of column(key) value pairs and passed to load_from_array(). * * @access public * @return array or false * @paramstring $sql SQL schema columns to use as array keys * @author Daevid Vincent [dae...@] * @version 1.0 * @date 08/13/07 * @see load_from_array() */ public function load_from_sql($sql = null) { if (is_null($sql)) return false; $result = SQL_QUERY($sql." LIMIT 1");
Re: [PHP] Custom function for inserting values into MySQL
I would take a look at some of the frameworks like codeignter to see how they do things. But like Davied mentioned a simpler way to handle the passing into the function would be Function save($table, $data) Where data is an array of key value pairs which takes your 22 parameters down to 2. The array could look like $data = array('id' => 1, 'name' => 'bob' ...) Bastien Sent from my iPod On Nov 2, 2009, at 8:32 PM, Allen McCabe wrote: Okay friends, I have been wondering about writing a simple function that will help me with my MySQL inserting. Not because I need to save time and space, but because I wanted to. I wrote a function for inserting 10 values (I have not been able to come up with an idea how to make the number of values I'm inserting variable, so I'm sticking with ten). This function takes 22 parameters: #1 is the table name, #2-21 are the row names and the values, and #22 is the "integar string". The first 21 parameters are self-explanatory, the 22nd is a string of values that need to be inserted as an integar, basically, not adding single quotes around the value. Eg. $value2 = 5, not $value2 = '5'. I am very hesitant to try this one out on my database, I've got tables of important information and don't want to, I don't know, inadvertantly throw a wrench into the works, AND I want to open up a dialoug about custom PHP functions for working with MySQL, for the fun of it! Here is my 10 value function for inserting data into a MySQL database table. function insertinto10($table, $field1, $value1, $field2, $value2, $field3, $value3, $field4, $value4, $field5, $value5, $field6, $value6, $field7, $value7, $field8, $value8, $field9, $value9, $field10, $value10, $int = NULL) { if (isset($int)) { $sPattern = '/\s*/m'; $sReplace = ''; $int = preg_replace($sPattern, $sReplace, $int); $pieces = explode(",", $int); // $pieces[0], $pieces[1] - each equal to value numbers that are integars $length = count($pieces); // call custom function to create associative array eg. $newarray [2] = 1, $newarray[4] = 1, $newarray[5] = 1 . . . $integarArray = strtoarray($length, $int); } $valuesArray = array($value1, $value2, $value3, $value4, $value5, $value6, $value7, $value8, $value9, $value10); foreach ($valuesArray as $key => $value) { if (isset($integarArray[$key]) && $integarArray[$key] == 1) { // INTEGAR VALUE $valuesArray[$key] = mysql_real_escape_string(stripslashes($value)); } else { // STRING VALUE $cleanValue = mysql_real_escape_string(stripslashes($value)); $valuesArray[$key] = "'{$cleanValue}'"; } } $result = mysql_query("INSERT INTO `{$table}` (`{$field1}`, ` {$field2}`, `{$field3}`, `{$field4}`) VALUES ({$valuesArray[1]}, {$valuesArray [2]}, {$valuesArray[3]}, {$valuesArray[4]}, {$valuesArray[5]}, {$valuesArray[6]}, {$valuesArray[7]}, {$valuesArray[8]}, {$valuesArray[9]}, {$valuesArray[10]})"); return $result; } You may find copying/pasting into your favorite code-editor helps make it more readable. Do you see any major hangups or screwups on first glance? And is my fear of trying this out on my database unfounded? Does this even seem that useful? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php