Re: [PHP] MySQL select matching
On Mon, 19 Jul 2010 10:36:40 -0600 "Ashley M. Kirchner" wrote: > mysql> select * from table where id='1'; > +---+-+-+---+ > | 1 | 123 | 0.0 | C | > | 1 | 234 | 0.1 | D | > | 1 | 345 | 0.0 | D | > | 1 | 456 | 0.1 | C | > | 1 | 567 | 0.1 | G | > +---+-+-+---+ > > Now, I have to find other IDs that match the above result. In the > table, that would be ID '3' (and in the entire DB, there may be > others as well - I need to find all those IDs.) But, notice how ID 0003 > isn't in the same order as ID 1, but the data is still the same. > select distinct id from `table` where concat(`b`, `c`, `d`) in (select concat(`b`,`c`,`d` from `table` where id = '0001') AND id != '0001'; (untested) -- Simcha Younger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eval and HEREDOC
On 21 July 2010 06:46, Sorin Buturugeanu wrote: > @Vincent: no, the short tags are not off. > > @Jim: This seamns to work fine: > > $template = file_get_contents(pathTemplates.$this->dir.$this->tpl); > ob_start(); > $template = eval('?>'.$template); > $template = ob_get_clean(); > > Thanks! > > Best wishes! > > Sorin > > > -- > Sorin Buturugeanu > http://www.soin.ro > > > > > On Wed, Jul 21, 2010 at 1:45 AM, wrote: >> >> >> >> On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu wrote: >>> Hello Vincent and thank you for your reply :). >>> >>> That's true, I forgot to explain how I got to using HEREDOC, so .. >>> >>> Using eval(file_get_contents($file)) just outputs the result on the >>> spot and I need >>> to get the whole output (without echoing it) and do some more things with >>> it. >>> >>> require_once() doesn't fit here (from what I can tell), because it >>> would still just >>> include the file in echo the output. >>> >>> I think there must be a solution, but I'm missing something here .. >> >> >> Check out the ob_* functions >> >> You could do this >> >> ob_start(); >> >> include "/your/file.php"; >> >> $output = ob_get_clean(); >> >> echo $output; >> >> Jim >> >>> >>> Thanks again! >>> >>> -- >>> Sorin Buturugeanu >>> http://www.soin.ro >>> >>> >>> On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent >>> wrote: > -Original Message- > From: Sorin Buturugeanu [mailto:m...@soin.ro] > Sent: Tuesday, July 20, 2010 2:11 PM > To: php-general@lists.php.net > Subject: [PHP] eval and HEREDOC > > Hello, > > I am having trouble with a part of my templating script. I'll > try to explain: > > The template itself is HTML with PHP code inside it, like: > > > > And I have the following code as part of the templating engine: > > $template = file_get_contents($file); > $template = "return <<>>> > $template = eval($template); > > The problem is that the eval() HEREDOC combination gives the > following output: > > > > If in the HTML file (template) I use > > > > I get as an output. > > I have tried closing the php tag like this: > > $template = "return <<".$template."\nTEMPLATE;\n"; > > but the extra ?> only gets outputed as HTML. > > This is my first post to this mailing list, so I great you > all and thank you for any kind of solution to my problem. Why are you using HEREDOC to begin with? I personally find them to be >>> ugly and more trouble than they're worth. You can write the same thing as this I think (untested): $template = eval(file_get_contents($file)); But you might also consider using "include_once" or "require_once" >>> instead of this "eval()" business. Also note, that a string can span more than one line and have variables >>> in it. It can even be used with code, so HEREDOC is again useless for most situations: $foo = " Hello $name,\n \n Today is ".date('Y-m-d')."\n \n Lorem ipsum dolor sit amet, consectetur adipiscing elit. \n Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue metus, mattis a sollicitudin in, placerat vitae elit. \n Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris. "; >>> >>> -- >>> 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 > > 1) heredoc is great for not caring about escaping ' or ". Whether or not you like the syntax it's not hard to use in any way. 2) stay away from eval. Just don't use it unless you have no other choice 3) the include+output buffering solution is much better. Another option would be to use markers in your templates and then just replace them with content. Whether or not that would suit you depends on what kinds of templates you're making and for what purpose Regards Peter -- WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind BeWelcome/Couchsurfing: Fake51 Twitter: http://twitter.com/kafe15 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec output to mySQL, How?
On Wed, Jul 21, 2010 at 8:49 AM, Tom Sparks wrote: > How do I take the output from a command line program and update a MYSQL > database with it? > > tom_a_sparks > Light travels faster then sound, which is why some people appear bright, > until you hear them speak > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > $cmdop=shell_exec('cmd'); $con=new mysqli(...); // Check connection error // Refer to php.net/mysqli $con->multi_query($cmdop); -- Regards, Nilesh Govindarajan Facebook: http://www.facebook.com/nilesh.gr Twitter: http://twitter.com/nileshgr Website: http://www.itech7.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eval and HEREDOC
@Vincent: no, the short tags are not off. @Jim: This seamns to work fine: $template = file_get_contents(pathTemplates.$this->dir.$this->tpl); ob_start(); $template = eval('?>'.$template); $template = ob_get_clean(); Thanks! Best wishes! Sorin -- Sorin Buturugeanu http://www.soin.ro On Wed, Jul 21, 2010 at 1:45 AM, wrote: > > > > On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu wrote: >> Hello Vincent and thank you for your reply :). >> >> That's true, I forgot to explain how I got to using HEREDOC, so .. >> >> Using eval(file_get_contents($file)) just outputs the result on the >> spot and I need >> to get the whole output (without echoing it) and do some more things with >> it. >> >> require_once() doesn't fit here (from what I can tell), because it >> would still just >> include the file in echo the output. >> >> I think there must be a solution, but I'm missing something here .. > > > Check out the ob_* functions > > You could do this > > ob_start(); > > include "/your/file.php"; > > $output = ob_get_clean(); > > echo $output; > > Jim > >> >> Thanks again! >> >> -- >> Sorin Buturugeanu >> http://www.soin.ro >> >> >> On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent >> wrote: >>> >>> > -Original Message- >>> > From: Sorin Buturugeanu [mailto:m...@soin.ro] >>> > Sent: Tuesday, July 20, 2010 2:11 PM >>> > To: php-general@lists.php.net >>> > Subject: [PHP] eval and HEREDOC >>> > >>> > Hello, >>> > >>> > I am having trouble with a part of my templating script. I'll >>> > try to explain: >>> > >>> > The template itself is HTML with PHP code inside it, like: >>> > >>> > >>> > >>> > And I have the following code as part of the templating engine: >>> > >>> > $template = file_get_contents($file); >>> > $template = "return <<>> > $template = eval($template); >>> > >>> > The problem is that the eval() HEREDOC combination gives the >>> > following output: >>> > >>> > >>> > >>> > If in the HTML file (template) I use >>> > >>> > >>> > >>> > I get as an output. >>> > >>> > I have tried closing the php tag like this: >>> > >>> > $template = "return <<".$template."\nTEMPLATE;\n"; >>> > >>> > but the extra ?> only gets outputed as HTML. >>> > >>> > This is my first post to this mailing list, so I great you >>> > all and thank you for any kind of solution to my problem. >>> >>> Why are you using HEREDOC to begin with? I personally find them to be >> ugly >>> and more trouble than they're worth. >>> >>> You can write the same thing as this I think (untested): >>> >>> $template = eval(file_get_contents($file)); >>> >>> But you might also consider using "include_once" or "require_once" >> instead >>> of this "eval()" business. >>> >>> Also note, that a string can span more than one line and have variables >> in >>> it. It can even be used with code, so HEREDOC is again useless for most >>> situations: >>> >>> $foo = " >>> Hello $name,\n >>> \n >>> Today is ".date('Y-m-d')."\n >>> \n >>> Lorem ipsum dolor sit amet, consectetur adipiscing elit. >>> \n >>> Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue >>> metus, mattis a sollicitudin in, placerat vitae elit. >>> \n >>> Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris. >>> "; >>> >> >> -- >> 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
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php array in different OS
Dear all, I have a simple test code in different OS ,but it give me a different result. the code as follows: "; } echo "count:",count($data); ?> OS1: Red Hat Enterprise Linux Server release 5.1 Linux 2.6.18-53.el5xen i686 i686 i386 GNU/Linux test result: the result is correct,it can display 5 data and count:5. OS2: CentOS release 5.4 Linux 2.6.18-164.el5 x86_64 x86_64 x86_64 GNU/Linux test result: the result is wrong,it can only display 31148 data and it can not display count value. I'm not sure the result relate to array capacity in different OS. Please give me some tips,thanks in advance. good luck, Yang Fei 2010-7-20 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exec output to mySQL, How?
How do I take the output from a command line program and update a MYSQL database with it? tom_a_sparks Light travels faster then sound, which is why some people appear bright, until you hear them speak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: eval and HEREDOC
Sorin Buturugeanu wrote: > Hello, > > I am having trouble with a part of my templating script. I'll try to > explain: > > The template itself is HTML with PHP code inside it, like: > > > > And I have the following code as part of the templating engine: > > $template = file_get_contents($file); > $template = "return << $template = eval($template); > > The problem is that the eval() HEREDOC combination gives the following > output: > > > > If in the HTML file (template) I use > > > > I get as an output. > > I have tried closing the php tag like this: > > $template = "return <<".$template."\nTEMPLATE;\n"; > > but the extra ?> only gets outputed as HTML. > > This is my first post to this mailing list, so I great you all and thank > you for any kind of solution to my problem. > > Thank you! Possibly your php environment has short-tags turned off. Cheers -- David Robley To save trouble later, Joe named his cat Roadkill Fred Today is Boomtime, the 56th day of Confusion in the YOLD 3176. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eval and HEREDOC
On Wed, 21 Jul 2010 01:04:12 +0300, Sorin Buturugeanu wrote: > Hello Vincent and thank you for your reply :). > > That's true, I forgot to explain how I got to using HEREDOC, so .. > > Using eval(file_get_contents($file)) just outputs the result on the > spot and I need > to get the whole output (without echoing it) and do some more things with > it. > > require_once() doesn't fit here (from what I can tell), because it > would still just > include the file in echo the output. > > I think there must be a solution, but I'm missing something here .. Check out the ob_* functions You could do this ob_start(); include "/your/file.php"; $output = ob_get_clean(); echo $output; Jim > > Thanks again! > > -- > Sorin Buturugeanu > http://www.soin.ro > > > On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent > wrote: >> >> > -Original Message- >> > From: Sorin Buturugeanu [mailto:m...@soin.ro] >> > Sent: Tuesday, July 20, 2010 2:11 PM >> > To: php-general@lists.php.net >> > Subject: [PHP] eval and HEREDOC >> > >> > Hello, >> > >> > I am having trouble with a part of my templating script. I'll >> > try to explain: >> > >> > The template itself is HTML with PHP code inside it, like: >> > >> > >> > >> > And I have the following code as part of the templating engine: >> > >> > $template = file_get_contents($file); >> > $template = "return <<> > $template = eval($template); >> > >> > The problem is that the eval() HEREDOC combination gives the >> > following output: >> > >> > >> > >> > If in the HTML file (template) I use >> > >> > >> > >> > I get as an output. >> > >> > I have tried closing the php tag like this: >> > >> > $template = "return <<".$template."\nTEMPLATE;\n"; >> > >> > but the extra ?> only gets outputed as HTML. >> > >> > This is my first post to this mailing list, so I great you >> > all and thank you for any kind of solution to my problem. >> >> Why are you using HEREDOC to begin with? I personally find them to be > ugly >> and more trouble than they're worth. >> >> You can write the same thing as this I think (untested): >> >> $template = eval(file_get_contents($file)); >> >> But you might also consider using "include_once" or "require_once" > instead >> of this "eval()" business. >> >> Also note, that a string can span more than one line and have variables > in >> it. It can even be used with code, so HEREDOC is again useless for most >> situations: >> >> $foo = " >> Hello $name,\n >> \n >> Today is ".date('Y-m-d')."\n >> \n >> Lorem ipsum dolor sit amet, consectetur adipiscing elit. >> \n >> Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue >> metus, mattis a sollicitudin in, placerat vitae elit. >> \n >> Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris. >> "; >> > > -- > 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] changing form based on variable
On Jul 20, 2010, at 13:28, David Mehler wrote: > Hello, > I've got a form, it's sticky, and it can either display on an insert > or update. Depending on whether i'm wanting to do an insert or update > the area the form gets it's input changes. > So, i've got a name field, if it's set to insert, not sure how to > differentiate between the two actions, name gets it's input from the > value of $_POST['name'] since it's sticky. If it's set to update that > name value is filled in by the name field output in a database. Also, > if insert the button for sending the form is called "add" if update > it's called "update" I'd like to know how to pull this off, because in > both cases the form entry fields are the same, i don't want to have to > write two forms when one should work. > Thanks. > Dave. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Simple, I assume you have an id for the record on update, so test for that and just adjust the value of the button. $btnValue = 'Submit'; If(isset($id)){ $btnValue ='Update'; } Bastien Sent from my iPod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Fwd: [PHP-DB] always the logic that messes me up.... Database fun!
Hey Everyone, I know it's not strictly on topic but the php-db list hasn't responded and I haven't gotten any farther :) So please read below and earn a free beer for anyone that can help me, and can make it to Florida :) Begin forwarded message: From: Jason Pruim Date: July 18, 2010 8:35:49 PM EDT To: php...@lists.php.net Subject: [PHP-DB] always the logic that messes me up Database fun! Hi everyone! I'm trying to put together a completely database driven site so I can learn how to do it... I've gone to the extent of creating apache rewrite rules to redirect all non-existent files/folders to my script to see if it exists which works perfectly. Where I'm running into trouble, is if I store the entire page inside the database, and inside that page I'm grabbing info from another part of the database how do I include that? Such as: pseudo -code: //Display current page info Grab current rate plans and prices from database finish displaying page. Now... It sounds easy enough but what I end up with on my page is: echo << hosting info hosting info host info hosting info hosting info hosting info host info hosting info Current Plans HTML; include "hostingprices.php"; echo << More info about hosting HTML; The only thing I changed was the actual text cause I didn't want to spam the list with my hosting schpeal :) So how do I make that work? Any points in a direction? :) -- PHP Database 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] eval and HEREDOC
Hello Vincent and thank you for your reply :). That's true, I forgot to explain how I got to using HEREDOC, so .. Using eval(file_get_contents($file)) just outputs the result on the spot and I need to get the whole output (without echoing it) and do some more things with it. require_once() doesn't fit here (from what I can tell), because it would still just include the file in echo the output. I think there must be a solution, but I'm missing something here .. Thanks again! -- Sorin Buturugeanu http://www.soin.ro On Wed, Jul 21, 2010 at 12:49 AM, Daevid Vincent wrote: > > > -Original Message- > > From: Sorin Buturugeanu [mailto:m...@soin.ro] > > Sent: Tuesday, July 20, 2010 2:11 PM > > To: php-general@lists.php.net > > Subject: [PHP] eval and HEREDOC > > > > Hello, > > > > I am having trouble with a part of my templating script. I'll > > try to explain: > > > > The template itself is HTML with PHP code inside it, like: > > > > > > > > And I have the following code as part of the templating engine: > > > > $template = file_get_contents($file); > > $template = "return << > $template = eval($template); > > > > The problem is that the eval() HEREDOC combination gives the > > following output: > > > > > > > > If in the HTML file (template) I use > > > > > > > > I get as an output. > > > > I have tried closing the php tag like this: > > > > $template = "return <<".$template."\nTEMPLATE;\n"; > > > > but the extra ?> only gets outputed as HTML. > > > > This is my first post to this mailing list, so I great you > > all and thank you for any kind of solution to my problem. > > Why are you using HEREDOC to begin with? I personally find them to be ugly > and more trouble than they're worth. > > You can write the same thing as this I think (untested): > > $template = eval(file_get_contents($file)); > > But you might also consider using "include_once" or "require_once" instead > of this "eval()" business. > > Also note, that a string can span more than one line and have variables in > it. It can even be used with code, so HEREDOC is again useless for most > situations: > > $foo = " > Hello $name,\n > \n > Today is ".date('Y-m-d')."\n > \n > Lorem ipsum dolor sit amet, consectetur adipiscing elit. > \n > Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue > metus, mattis a sollicitudin in, placerat vitae elit. > \n > Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris. > "; > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] eval and HEREDOC
> -Original Message- > From: Sorin Buturugeanu [mailto:m...@soin.ro] > Sent: Tuesday, July 20, 2010 2:11 PM > To: php-general@lists.php.net > Subject: [PHP] eval and HEREDOC > > Hello, > > I am having trouble with a part of my templating script. I'll > try to explain: > > The template itself is HTML with PHP code inside it, like: > > > > And I have the following code as part of the templating engine: > > $template = file_get_contents($file); > $template = "return << $template = eval($template); > > The problem is that the eval() HEREDOC combination gives the > following output: > > > > If in the HTML file (template) I use > > > > I get as an output. > > I have tried closing the php tag like this: > > $template = "return <<".$template."\nTEMPLATE;\n"; > > but the extra ?> only gets outputed as HTML. > > This is my first post to this mailing list, so I great you > all and thank you for any kind of solution to my problem. Why are you using HEREDOC to begin with? I personally find them to be ugly and more trouble than they're worth. You can write the same thing as this I think (untested): $template = eval(file_get_contents($file)); But you might also consider using "include_once" or "require_once" instead of this "eval()" business. Also note, that a string can span more than one line and have variables in it. It can even be used with code, so HEREDOC is again useless for most situations: $foo = " Hello $name,\n \n Today is ".date('Y-m-d')."\n \n Lorem ipsum dolor sit amet, consectetur adipiscing elit. \n Nulla eros purus, pharetra a blandit non, pellentesque et leo. In augue metus, mattis a sollicitudin in, placerat vitae elit. \n Quisque elit mauris, varius sit amet cursus sed, eleifend a mauris. "; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] eval and HEREDOC
Hello, I am having trouble with a part of my templating script. I'll try to explain: The template itself is HTML with PHP code inside it, like: And I have the following code as part of the templating engine: $template = file_get_contents($file); $template = "return << If in the HTML file (template) I use I get as an output. I have tried closing the php tag like this: $template = "return <<".$template."\nTEMPLATE;\n"; but the extra ?> only gets outputed as HTML. This is my first post to this mailing list, so I great you all and thank you for any kind of solution to my problem. Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] changing form based on variable
Hello, I've got a form, it's sticky, and it can either display on an insert or update. Depending on whether i'm wanting to do an insert or update the area the form gets it's input changes. So, i've got a name field, if it's set to insert, not sure how to differentiate between the two actions, name gets it's input from the value of $_POST['name'] since it's sticky. If it's set to update that name value is filled in by the name field output in a database. Also, if insert the button for sending the form is called "add" if update it's called "update" I'd like to know how to pull this off, because in both cases the form entry fields are the same, i don't want to have to write two forms when one should work. Thanks. Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
On Tue, Jul 20, 2010 at 10:35 AM, wrote: > We are doing it with nfs mount which is mounted on all servers > > -- > Shafiq > http://shafiq.pk > *** This Message Has Been Sent Using BlackBerry Internet Service from > Mobilink *** > > -Original Message- > From: Dan Joseph > Date: Tue, 20 Jul 2010 10:21:55 > To: PHP eMail List > Subject: [PHP] Image Replication > Hi, > > I'm wondering how you all are doing image replication between servers. I've > got some things in mind, but I'd like to see how others have done it. > > We have a PHP application that accepts an image upload, then we want it to > show up on the other 2 web servers. We have 3 in a load balanced cluster. > Linux servers. > > How did you go about it? > > -- > -Dan Joseph > > http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. > Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also > available! > > http://www.facebook.com/canishosting > http://www.facebook.com/originalpoetry > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Our app runs using a piece of SAN / NAS storage common to all servers -- Bastien Cat, the other other white meat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
We are doing it with nfs mount which is mounted on all servers -- Shafiq http://shafiq.pk *** This Message Has Been Sent Using BlackBerry Internet Service from Mobilink *** -Original Message- From: Dan Joseph Date: Tue, 20 Jul 2010 10:21:55 To: PHP eMail List Subject: [PHP] Image Replication Hi, I'm wondering how you all are doing image replication between servers. I've got some things in mind, but I'd like to see how others have done it. We have a PHP application that accepts an image upload, then we want it to show up on the other 2 web servers. We have 3 in a load balanced cluster. Linux servers. How did you go about it? -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image Replication
Dan Joseph wrote: > Hi, > > I'm wondering how you all are doing image replication between servers. > I've got some things in mind, but I'd like to see how others have > done it. > > We have a PHP application that accepts an image upload, then we want > it to show up on the other 2 web servers. We have 3 in a load > balanced cluster. Linux servers. > > How did you go about it? rsync triggered by inotify. -- Per Jessen, Zürich (27.8°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image Replication
Hi, I'm wondering how you all are doing image replication between servers. I've got some things in mind, but I'd like to see how others have done it. We have a PHP application that accepts an image upload, then we want it to show up on the other 2 web servers. We have 3 in a load balanced cluster. Linux servers. How did you go about it? -- -Dan Joseph http://www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code "NEWTHINGS" for 10% off initial order -- Reseller Plans also available! http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry
Re: [PHP] MySQL Query Puzzle
I am very keen to see a closure to this thread so that I can add to my snippets. Let's all know what worked best out of many solutions that have been proposed. --Shreyas On Tue, Jul 20, 2010 at 10:07 AM, Jim Lucas wrote: > Peter wrote: > >> Hi All, >> >> I have a table which contain's some duplicate rows. I just want to delete >> the duplicate records alone >> not original records. >> >> Assume my table as look as below >> >> column1 column2 >> 1 >>a >> 1 >>a >> 2 >>b >> 3 >>c >> 3 >>c >> >> >> >> i want the above table need to be as below, After executing the mysql >> query. >> >> column1 >>column2 >> 1 >>a >> 2 >>b >> 3 >>c >> >> >> >> >> Thanks in advance.. >> >> Regards >> Peter >> >> > Use the SQL command alter with the ignore flag. > > ALTER IGNORE TABLE `your_table` ADD UNIQUE ( `column1` , `column2` ) > > I tested this on my test DB and it worked fine. It erased all the > duplicates and left one instance of the multiple entry values. > > This will add a permanent unique restraint to the table. So, you will > never have dupps again. > > Jim Lucas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Shreyas Agasthya
Re: [PHP] Determining the similarity between a user supplied short piece of text (between 5 and 15 characters) and a list of similar length text items.
On 19 July 2010 19:46, tedd wrote: > At 12:39 PM +0100 7/19/10, Richard Quadling wrote: >> >> I'm using MS SQL, not mySQL. >> >> Found a extended stored procedure with a UDF. >> >> Testing it looks excellent. >> >> Searching for a match on 30,000 vehicles next to no additional time - >> a few seconds in total, compared to the over 3 minutes to search using >> SQL code. > > That seems a bit slow. > > For example, currently I'm searching over 4,000 records (which contains > 4,000 paragraphs taken from the text of the King James version of the Bible) > for matching words, such as %created% and the times are typically around > 0.009 seconds. > > As such, searching ten times that amount should be in the range of tenths of > a second and not seconds -- so taking a few seconds to search 30,000 records > seems excessive to me. Tedd, I'm not looking for a "word". I'm looking for similar "wrds". Word is closer to the misspelled wrds that it is to wars. select dbo.DamerauLevenshteinDistance('words', 'wars'), dbo.DamerauLevenshteinDistance('words', 'wrds') (No column name)(No column name) 2 1 Lower is better. Also, I have to compare every row in the set and then sort it to find the lowest values for the Damerau-Levenshtein or the highest for the Jaro–Winkler distance. As the value entered is always going to be the unknown, I can't pre-calculate the distances. I do an exact match test first. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] socket problem
Hi All; I have got problem on socket. First client send query on socket and running process for first client, socket blocking. Second client same time send query socket, accept second client but not runing process. Waiting first client end process. How can I do multi client runing process etc apache,telnet? Is it possible with php? __ ESET Smart Security Akıllı Güvenlik tarafından sağlanan bilgiler, virüs imza veritabanı sürümü: 5293 (20100719) __ İleti ESET Smart Security Akıllı Güvenlik tarafından denetlendi. http://www.nod32.com.tr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php