Re: [PHP] Another problem with grids and checkboxes
Hello, > > 1 > name="grid[1][1]" value="1" type="checkbox"> > > > [snip] > > 1 > name="grid[2][1]" value="1" type="checkbox"> > > > > Is there a reason you're sending a 1, 2 or 3 value > with the checkboxes? Well, I thought it was the good way to do. It helps me to know which box has been checked (?). Yes, because > You already know what was checked by the keys of the > $grid array. I'd Yes, ok. > 1 name="grid[1][1]" value="1" > type="checkbox" checked';}?>> I let the value as it was because I would need to rename a few hundreds checkboxes :-/ but I had used your test in PHP if (isset($grid... and it works fine. In fact it was very simple. When I think the time I tried to find a solution. Shame on me. Ok, my excuse is that I'm just learning. Thank you very much. Vous manquez despace pour stocker vos mails ? Yahoo! Mail vous offre GRATUITEMENT 100 Mo ! Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/ Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with grids and checkboxes
Henri Marc wrote: 1 [snip] 1 Is there a reason you're sending a 1, 2 or 3 value with the checkboxes? You already know what was checked by the keys of the $grid array. I'd leave it similar to how you have it, but just pass 1 for every value (since you won't be needing it). You can create your grid like this: 1> 2> etc... That'll "remember" what boxes were checked when the grid is redisplayed, also. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with mysql version coding
You should be asking these questions on a MySQL list... DELETE FROM table WHERE laikas < NOW() - INTERVAL 60 DAY AND admin != 1 Works on MySQL 3 and 4. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ > -Original Message- > From: NeXaS [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 05, 2003 10:37 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Another problem with mysql version coding > > Hey all, the next code i wrote is for deleting users who don`t login > for 60 days. This script should work under 4.x.x series of MySQL DB, > but i have 3.x.x version. What should i change in this code that it > should work on 3.x.x version of MySQL. ( time is given as a timestamp > ( saved as time() in mysql ) ). > > The Code: > > $GLOBALS['data'] = date ("Y-m-d",$timelt); > $GLOBALS['laik'] = date("H:i:s",$timelt); > $queriz = "SELECT vartotojas, laikas FROM useriai WHERE > (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas) AS > SIGNED))>5184000 AND admin != '1'"; > $rezult = mysql_query($queriz); > if (mysql_num_rows($rezult) != 0) { > while ($row2 = mysql_fetch_array($rezult)) { >$ka = $row2['vartotojas']; >$query = "INSERT INTO logai SET kas='SISTEMA', ka='$ka', > data='$GLOBALS[data]', laikas='$GLOBALS[laik]'"; >echo mysql_error(); >mysql_query($query); >$delete = "DELETE FROM useriai WHERE > (CAST(UNIX_TIMESTAMP(NOW()) AS SIGNED) - CAST(UNIX_TIMESTAMP(laikas) AS > SIGNED))>5184000 AND admin != '1'"; >$del = mysql_query($delete); > } > } > > > P.S. It Also add info to mysql db as logo who delete the user ;-) > > Thanks if someone could help! NeXaS > > > > -- > 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] Another Problem installing PHP 4.3.1 - won't compile due to error.
Yup, you were correct. the 7.10.3 rpm was installed but I forgot to install the 7.10.3 development rpm. I did so and all compiles fine now. Thanks, Don > My guess you have a mess in your curl library installation. For example > you use header from version 7.9.5 and specify that you have version > 7.10.3. Find all libcurl.so and curl.h files on your system and check if > they are really the version you think they are. You may try running rpm > -V libcurl(-devel), this verifys if any file has changed > > Don wrote: > > >Ok, that problem solved but now another one pops up when I run 'make'. > >Please note that it is complaining about code that came with the PHP tarball > >and I haven't changed anything. Below are the errors for your viewing > >(dis)pleasure. Any guidance would be appreciated. This isn't supposed to > >be so hard. > > > > > > > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another Problem installing PHP 4.3.1 - won't compile dueto error.
My guess you have a mess in your curl library installation. For example you use header from version 7.9.5 and specify that you have version 7.10.3. Find all libcurl.so and curl.h files on your system and check if they are really the version you think they are. You may try running rpm -V libcurl(-devel), this verifys if any file has changed Don wrote: Ok, that problem solved but now another one pops up when I run 'make'. Please note that it is complaining about code that came with the PHP tarball and I haven't changed anything. Below are the errors for your viewing (dis)pleasure. Any guidance would be appreciated. This isn't supposed to be so hard. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another Problem installing PHP 4.3.1 - won't compile due to error.
Ok, that problem solved but now another one pops up when I run 'make'. Please note that it is complaining about code that came with the PHP tarball and I haven't changed anything. Below are the errors for your viewing (dis)pleasure. Any guidance would be appreciated. This isn't supposed to be so hard. In file included from /usr/local/php-4.3.1/ext/curl/curl.c:45: /usr/local/php-4.3.1/ext/curl/php_curl.h:115: parse error before `CURLM' /usr/local/php-4.3.1/ext/curl/php_curl.h:115: warning: no semicolon at end of struct or union /usr/local/php-4.3.1/ext/curl/php_curl.h:124: parse error before `mcode' /usr/local/php-4.3.1/ext/curl/php_curl.h:124: warning: data definition has no type or storage class /usr/local/php-4.3.1/ext/curl/php_curl.h:127: parse error before `}' /usr/local/php-4.3.1/ext/curl/php_curl.h:127: warning: data definition has no type or storage class /usr/local/php-4.3.1/ext/curl/curl.c: In function `zm_startup_curl': /usr/local/php-4.3.1/ext/curl/curl.c:182: `CURLOPT_CAPATH' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:182: (Each undeclared identifier is reported only once /usr/local/php-4.3.1/ext/curl/curl.c:182: for each function it appears in.) /usr/local/php-4.3.1/ext/curl/curl.c:221: `CURLINFO_REDIRECT_TIME' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:222: `CURLINFO_REDIRECT_COUNT' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:278: `CURL_NETRC_OPTIONAL' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:279: `CURL_NETRC_IGNORED' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:280: `CURL_NETRC_REQUIRED' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c: In function `zif_curl_setopt': /usr/local/php-4.3.1/ext/curl/curl.c:732: `CURLOPT_CAPATH' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c: In function `zif_curl_getinfo': /usr/local/php-4.3.1/ext/curl/curl.c:1053: `CURLINFO_REDIRECT_COUNT' undeclared (first use in this function) /usr/local/php-4.3.1/ext/curl/curl.c:1077: `CURLINFO_REDIRECT_TIME' undeclared (first use in this function) make: *** [ext/curl/curl.lo] Error 1 > Assuming you also installed ucd-snmp-devel-*.rpm, likely you need to > specify --with-snmp=/usr or --with-snmp=/usr//include/ucd-snmp > > Don wrote: > > >Ok, now that I've solved my 'curl' problem, I've run in to another problem. > >Now I am getting teh following error: > > > >"configure: error: snmp.h not found. Check your SNMP installation." > > > >I've installed the ucd-snmp rpms so what am I missing? > > > >Thanks, > >Don > > > >- Original Message - > >From: "Marek Kilimajer" <[EMAIL PROTECTED]> > >To: "Don" <[EMAIL PROTECTED]> > >Cc: "php list" <[EMAIL PROTECTED]> > >Sent: Tuesday, April 01, 2003 11:45 AM > >Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to > >odderror. > > > > > > > > > >>You might have it installed twice (e.g. once from rpm and once from > >>source). Try > >>locate curl-config > >> > >> > >>Don wrote: > >> > >> > >> > >>>Ok. I seemed to have solved the problem but it seemed really dumb to me. > >>> > >>> > >I > > > > > >>>did a "curl -version" from teh command prompt and it outputed 7.10.3 > >>> > >>>BUT, when I looked at the "curl-config" file, it specified the following > >>> > >>> > >for > > > > > >>>the --version section: > >>> > >>>--version) > >>>echo libcurl 7.9.5 > >>>exit 0 > >>>;; > >>> > >>>So, all I did was change the 7.9.5 to 7.10.3 and no more compile > >>> > >>> > >error. > > > > > >>>Silly huh? > >>> > >>>- Original Message - > >>>From: "Adam Voigt" <[EMAIL PROTECTED]> > >>>To: "Don" <[EMAIL PROTECTED]> > >>>Sent: Tuesday, April 01, 2003 11:19 AM > >>>Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to > >>>odderror. > >>> > >>> > >>> > >>> > >>> > >>> > Just out of curiosity, try --with-curl=/usr. > > On Tue, 2003-04-01 at 11:12, Don wrote: > > > > > >I altered the configuration to say --> --with-curl=/usr/bin as that is > > > > > > > > > >>>the > >>> > >>> > >>> > >>> > >location of the curl executable but I am still getting the compile > > > > > > > > > >>>error. > >>> > >>> > >>> > >>> > >Any other suggestion? > > > >- Original Message - > >From: "Marek Kilimajer" <[EMAIL PROTECTED]> > >To: "Don" <[EMAIL PROTECTED]> > >Cc: "php list" <[EMAIL PROTECTED]> > >Sent: Tuesday, April 01, 2003 7:27 AM > >Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to > > > > > > > > > >>>odd > >>> > >>> > >>> > >>> > >error. > > > > > > > > > > > > > >>Run ./configure --help, it will tell you how to specify the path to > >> > >> > >> > >> > >>>curl > >>> > >>> > >>> > >>> > >>libraries > >> > >>Don wrote: > >
Re: [PHP] Another Problem installing PHP 4.3.1 - won't compile dueto odderror.
Assuming you also installed ucd-snmp-devel-*.rpm, likely you need to specify --with-snmp=/usr or --with-snmp=/usr//include/ucd-snmp Don wrote: Ok, now that I've solved my 'curl' problem, I've run in to another problem. Now I am getting teh following error: "configure: error: snmp.h not found. Check your SNMP installation." I've installed the ucd-snmp rpms so what am I missing? Thanks, Don - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> To: "Don" <[EMAIL PROTECTED]> Cc: "php list" <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 11:45 AM Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to odderror. You might have it installed twice (e.g. once from rpm and once from source). Try locate curl-config Don wrote: Ok. I seemed to have solved the problem but it seemed really dumb to me. I did a "curl -version" from teh command prompt and it outputed 7.10.3 BUT, when I looked at the "curl-config" file, it specified the following for the --version section: --version) echo libcurl 7.9.5 exit 0 ;; So, all I did was change the 7.9.5 to 7.10.3 and no more compile error. Silly huh? - Original Message - From: "Adam Voigt" <[EMAIL PROTECTED]> To: "Don" <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 11:19 AM Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to odderror. Just out of curiosity, try --with-curl=/usr. On Tue, 2003-04-01 at 11:12, Don wrote: I altered the configuration to say --> --with-curl=/usr/bin as that is the location of the curl executable but I am still getting the compile error. Any other suggestion? - Original Message - From: "Marek Kilimajer" <[EMAIL PROTECTED]> To: "Don" <[EMAIL PROTECTED]> Cc: "php list" <[EMAIL PROTECTED]> Sent: Tuesday, April 01, 2003 7:27 AM Subject: Re: [PHP] Problem installing PHP 4.3.1 - won't compile due to odd error. Run ./configure --help, it will tell you how to specify the path to curl libraries Don wrote: Hi, Trying to install PHP 4.3.1 but getting the following error message: "configure error: cURL version 7.9.8 or later is required to compile php with cURL support" I have curl installed; when I issue a "curl -V", the version number reported is 7.10.3 Can anyone tell me what the install is looking for? Thanks in advance, Don --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.465 / Virus Database: 263 - Release Date: 3/25/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] another problem with 4.3.0 : imagecreatefromjpeg undefined
On Friday 31 January 2003 23:22, Robert Mena wrote: > Hello again, > > another problem with 4.3.0. I have gd support but > after the upgrade my scripts started complaing : > > Fatal error: Call to undefined function: > imagecreatefromjpeg() > > My ./configure (the same used for ages). > > './configure' '--with-apxs' '--with-ttf' '--with-xml' > '--with-gd' '--with-ftp' '--enable-session' > '--enable-trans-sid' '--with-zlib' > '--enable-inline-optimization' '--with-mcrypt' > '--enable-sigchild' '--with-config-file-path=/etc' '--with-freetype' You probably need to add "--with-jpeg-dir" as well (and make sure you really do have libjpeg installed). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* To love is good, love being difficult. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 03:15 > > > Using switch would be more efficiant as it would stop once a > match is made > (if you use break), but with eleif statements each one is evaluated in > order. Not sure that's true -- a sequence of elseifs will also stop evaluating once one of the conditions has evaluated to true. The essential difference is that a switch/case structure is a repeated test against a single value (possibly derived from an expression), whereas an if ... elseif sequence can test multiple completely disjoint conditions. > $chr = substr($a,$i,1); > switch (TRUE) { > > case $chr == "á" || $chr == "à" || $chr == "ã" || $chr == "â": > $a = str_replace(substr($a,$i,1),"a",$a); > break; > > case $chr == "é" || $chr == "è" || $chr == "ê": > $a = str_replace(substr($a,$i,1),"e",$a); > break; > > } Actually, I'm not sure that's a good example, either! I'd have thought it was better written as: switch (substr($a,$i,1)) { case "á": case "à": case "ã": case "â": $a = str_replace(substr($a,$i,1),"a",$a); break; case "é": case "è": case "ê": $a = str_replace(substr($a,$i,1),"e",$a); break; } Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Sean Malloy [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 02:36 > To: PHP General > Subject: RE: [PHP] Another problem with conditional statements > > > Nowhere in the documentation does it specify switch should be > used in the > context you are attempting. The docs say: "In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is exactly what the switch statement is for." TRUE is an expression, and so can be the subject of a switch statement. > The docs show a single variable and checking the case of that > variable. Admittedly all the examples in the manual use a single variable, but from the first sentence of the switch description: "The switch statement is similar to a series of IF statements on the same expression." ... I think it's reasonable to deduce that the parentheses after switch can contain any legitimate expression. Admittedly, all the examples in the manual use a single variable -- perhaps you might want to submit a Documentation Problem bug report suggesting some more complex examples. Actually, looking at the online manual again, I see several user notes with potential candidates for moving to the manual proper, including one which demonstrates the exact usage that the OP was having problems with. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Rick Emery [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 00:34 > > switch() does not work that way. Switch uses the value in > the parentheses and selects a > CASE based upon that value. Read the manual. > > You will have to use a series of if()-elseif()-else() Not true. Absolutely nothing wrong with using switch in this way -- it's a very neat and useful device. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem with conditional statements
> -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: 20 December 2002 00:19 > > This should be as simple as breathing, but not today. I have > two variables > $a and $b which I need to compare in a switch statement in > several different > ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and > $b is equal to > 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stuff; > break; > > endswitch; Well, I've just cut-and-pasted this code and added a few echo statements (and some other twiddles to get suitable values in), and it works perfectly -- so I'd say your $a and $b aren't getting the values you think they are. As a firtst step, I suggest you echo them out immediately before the switch statement and see what you've got. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
On Friday 20 December 2002 08:28, Sean Malloy wrote: > Its all wrong. You shouldn't be using a switch statement anyway. A switch > is for evaluating a single variable. You can use the switch construct in the context that the OP was using it. In fact I prefer use that instead of a whole bunch of if-then-else statements. For one thing it looks (IMO) a lot neater. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
On Friday 20 December 2002 08:19, Beauford.2002 wrote: > Hi, > > This should be as simple as breathing, but not today. I have two variables > $a and $b which I need to compare in a switch statement in several > different ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and $b is equal > to 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stuff; > break; > > endswitch; AFAICS all of them should work. The 2nd case may not work the way you intended. It is testing for, if $a is TRUE, AND if $b equals 124. Where are you getting $a and $b from? -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* You'll feel much better once you've given up hope. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
>From the manual at www.php.net. This is a lot more sophiticated than mine and apparantly works. So as a recent user of PHP, I'm at a loss as to what is and what isn't. Using switch would be more efficiant as it would stop once a match is made (if you use break), but with eleif statements each one is evaluated in order. $chr = substr($a,$i,1); switch (TRUE) { case $chr == "á" || $chr == "à" || $chr == "ã" || $chr == "â": $a = str_replace(substr($a,$i,1),"a",$a); break; case $chr == "é" || $chr == "è" || $chr == "ê": $a = str_replace(substr($a,$i,1),"e",$a); break; } - Original Message - From: "Sean Malloy" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 9:36 PM Subject: RE: [PHP] Another problem with conditional statements > Nowhere in the documentation does it specify switch should be used in the > context you are attempting. > > The docs show a single variable and checking the case of that variable. > > I'm not going to berate you on syntax. If you can get it working like that > then good for you. However, I would strongly advise you to use the > if/elseif/else statements instead. > > an example of switch > > $action = $_POST['action'] > switch ($action) > { > case 'help': showHelp(); break; > default : showDefault(); > } > > not > > $action = $_POST['action'] > switch (true) > { > case ($action == 'help'): showHelp(); break; > default : showDefault(); > } > > > > -Original Message- > > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > > Sent: Friday, 20 December 2002 12:46 PM > > To: Rick Emery > > Cc: PHP General > > Subject: Re: [PHP] Another problem with conditional statements > > > > > > I believe you are incorrect. Switch will look for the first case statement > > that is true and execute that statement. The following works - case one is > > incorrect so it doesn't get executed but the second case does. Paste this > > into a test.php file and you will see it works.. Read the manual. > > > > $a=2; > > $b=4; > > > > switch (true) { > > case ($a < $b) and ($b > 5): > > echo "Incorrect"; > > case ($a == 2): > > echo "Correct"; > > } > > > > So my original question is still stands. The switch statement is correct, > > but there is a problem with my conditional statements. > > > > - Original Message - > > From: "Rick Emery" <[EMAIL PROTECTED]> > > To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" > > <[EMAIL PROTECTED]> > > Sent: Thursday, December 19, 2002 7:33 PM > > Subject: Re: [PHP] Another problem with conditional statements > > > > > > > switch() does not work that way. Switch uses the value in the > > parentheses > > and selects a > > > CASE based upon that value. Read the manual. > > > > > > You will have to use a series of if()-elseif()-else() > > > - Original Message - > > > From: "Beauford.2002" <[EMAIL PROTECTED]> > > > To: "PHP General" <[EMAIL PROTECTED]> > > > Sent: Thursday, December 19, 2002 6:19 PM > > > Subject: [PHP] Another problem with conditional statements > > > > > > > > > Hi, > > > > > > This should be as simple as breathing, but not today. I have > > two variables > > > $a and $b which I need to compare in a switch statement in several > > different > > > ways, but no matter what I do it's wrong. > > > > > > This is what I have tried, can someone tell me how it should be. > > > > > > TIA > > > > > > switch (true): > > > > > > case ($a == $b): This one seems simple enough. > > > do sum stuff; > > > break; > > > > > > case ($a && $b == 124): This appears not to work. > > > do sum stuff; > > > break; > > > > > > case ($a == 124 && $b == 755): If $a is equal to 124 and > > $b is equal > > to > > > 755 then it should be true..doesn't work. > > > do sum stuff; > > > break; > > > > > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > > > either. > > > do sum stuff; > > > break; > > > > > > endswitch; > > > > > > > > > > > > -- > > > 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 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] Another problem with conditional statements
Nowhere in the documentation does it specify switch should be used in the context you are attempting. The docs show a single variable and checking the case of that variable. I'm not going to berate you on syntax. If you can get it working like that then good for you. However, I would strongly advise you to use the if/elseif/else statements instead. an example of switch $action = $_POST['action'] switch ($action) { case 'help': showHelp(); break; default : showDefault(); } not $action = $_POST['action'] switch (true) { case ($action == 'help'): showHelp(); break; default : showDefault(); } > -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: Friday, 20 December 2002 12:46 PM > To: Rick Emery > Cc: PHP General > Subject: Re: [PHP] Another problem with conditional statements > > > I believe you are incorrect. Switch will look for the first case statement > that is true and execute that statement. The following works - case one is > incorrect so it doesn't get executed but the second case does. Paste this > into a test.php file and you will see it works.. Read the manual. > > $a=2; > $b=4; > > switch (true) { > case ($a < $b) and ($b > 5): > echo "Incorrect"; > case ($a == 2): > echo "Correct"; > } > > So my original question is still stands. The switch statement is correct, > but there is a problem with my conditional statements. > > - Original Message - > From: "Rick Emery" <[EMAIL PROTECTED]> > To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" > <[EMAIL PROTECTED]> > Sent: Thursday, December 19, 2002 7:33 PM > Subject: Re: [PHP] Another problem with conditional statements > > > > switch() does not work that way. Switch uses the value in the > parentheses > and selects a > > CASE based upon that value. Read the manual. > > > > You will have to use a series of if()-elseif()-else() > > - Original Message - > > From: "Beauford.2002" <[EMAIL PROTECTED]> > > To: "PHP General" <[EMAIL PROTECTED]> > > Sent: Thursday, December 19, 2002 6:19 PM > > Subject: [PHP] Another problem with conditional statements > > > > > > Hi, > > > > This should be as simple as breathing, but not today. I have > two variables > > $a and $b which I need to compare in a switch statement in several > different > > ways, but no matter what I do it's wrong. > > > > This is what I have tried, can someone tell me how it should be. > > > > TIA > > > > switch (true): > > > > case ($a == $b): This one seems simple enough. > > do sum stuff; > > break; > > > > case ($a && $b == 124): This appears not to work. > > do sum stuff; > > break; > > > > case ($a == 124 && $b == 755): If $a is equal to 124 and > $b is equal > to > > 755 then it should be true..doesn't work. > > do sum stuff; > > break; > > > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > > either. > > do sum stuff; > > break; > > > > endswitch; > > > > > > > > -- > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
I believe you are incorrect. Switch will look for the first case statement that is true and execute that statement. The following works - case one is incorrect so it doesn't get executed but the second case does. Paste this into a test.php file and you will see it works.. Read the manual. $a=2; $b=4; switch (true) { case ($a < $b) and ($b > 5): echo "Incorrect"; case ($a == 2): echo "Correct"; } So my original question is still stands. The switch statement is correct, but there is a problem with my conditional statements. - Original Message - From: "Rick Emery" <[EMAIL PROTECTED]> To: "Beauford.2002" <[EMAIL PROTECTED]>; "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 7:33 PM Subject: Re: [PHP] Another problem with conditional statements > switch() does not work that way. Switch uses the value in the parentheses and selects a > CASE based upon that value. Read the manual. > > You will have to use a series of if()-elseif()-else() > - Original Message - > From: "Beauford.2002" <[EMAIL PROTECTED]> > To: "PHP General" <[EMAIL PROTECTED]> > Sent: Thursday, December 19, 2002 6:19 PM > Subject: [PHP] Another problem with conditional statements > > > Hi, > > This should be as simple as breathing, but not today. I have two variables > $a and $b which I need to compare in a switch statement in several different > ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and $b is equal to > 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stuff; > break; > > endswitch; > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem with conditional statements
switch() does not work that way. Switch uses the value in the parentheses and selects a CASE based upon that value. Read the manual. You will have to use a series of if()-elseif()-else() - Original Message - From: "Beauford.2002" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 6:19 PM Subject: [PHP] Another problem with conditional statements Hi, This should be as simple as breathing, but not today. I have two variables $a and $b which I need to compare in a switch statement in several different ways, but no matter what I do it's wrong. This is what I have tried, can someone tell me how it should be. TIA switch (true): case ($a == $b): This one seems simple enough. do sum stuff; break; case ($a && $b == 124): This appears not to work. do sum stuff; break; case ($a == 124 && $b == 755): If $a is equal to 124 and $b is equal to 755 then it should be true..doesn't work. do sum stuff; break; case ($a == 124 && $b != 124): Nope, this doesn't appear to work either. do sum stuff; break; endswitch; -- 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] Another problem with conditional statements
Its all wrong. You shouldn't be using a switch statement anyway. A switch is for evaluating a single variable. alss, your code if ($a && $b == 124) is the equivelent of writing if ($a == true && $b == 124). if ($a == $b) { // do struff } elseif ( ($a == 124) && ($b == 124) ) { //do stuff } elseif ( ($a == 124) && ($b == 755) ) { //do stuff } elseif ( ($a == 124) && ($a != $b) ) { // do stuff } else { // do default } a switch statement is used in this context; $a = 1; switch ($a) { case 1: $blah = $a; break; case 2: $blah = 'something else'; break; default: $blah = 'nothing'; } you evaluate a single variable, otherwise, you are stuck with using is/else statements > -Original Message- > From: Beauford.2002 [mailto:[EMAIL PROTECTED]] > Sent: Friday, 20 December 2002 11:19 AM > To: PHP General > Subject: [PHP] Another problem with conditional statements > > > Hi, > > This should be as simple as breathing, but not today. I have two variables > $a and $b which I need to compare in a switch statement in > several different > ways, but no matter what I do it's wrong. > > This is what I have tried, can someone tell me how it should be. > > TIA > > switch (true): > > case ($a == $b): This one seems simple enough. > do sum stuff; > break; > > case ($a && $b == 124): This appears not to work. > do sum stuff; > break; > > case ($a == 124 && $b == 755): If $a is equal to 124 and $b > is equal to > 755 then it should be true..doesn't work. > do sum stuff; > break; > > case ($a == 124 && $b != 124): Nope, this doesn't appear to work > either. > do sum stuff; > break; > > endswitch; > > > > -- > 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] Another problem
<> No, I've got the text/ascii header in there. I have it send an HTML and a text version. Both look very different. The only problem with the text version is that there are no line breaks... Until it encounters a P tag. It's weird, but I have those completely stripped out, but the BR tags I have replaced. The P tags should make no difference. Oh yeah, and it *was* a typo. It really is \r\n. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Another problem
Hi Liam, > *sigh* They never stop. I know the feeling ;-) > For some reason, when I replace my tags with \n\r > and print the resulting line on-screen, it works. But > when I e-mail the lines, the \n\r seems to disappear I think it might be \r\n, not \n\r. The "works on-screen but not on email" thing is probably down to the fact that \n on its own should work on screen - the \r is ignored. HTH Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem
[EMAIL PROTECTED] wrote: >For some reason, when I replace my tags with \n\r and print the > Do you mean \r\n (carriage return, line feed)? Is this a typo in your post or is it the problem? HTH Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem
You might be getting the emails in HTML mode, try adding "Content-type:text/ascii" to your extra headers section of the mail command. Adam Voigt [EMAIL PROTECTED] On Tue, 2002-10-08 at 12:22, [EMAIL PROTECTED] wrote: > *sigh* They never stop. > > I have a series of lines that I put through a function that strips tags and > replaces them with their best string equivalents (bold tags turn into *s and > such). > > For some reason, when I replace my tags with \n\r and print the > resulting line on-screen, it works. But when I e-mail the lines, the \n\r > seems to disappear and all lines run into one another. For some reason, this > doesn't happen with P tags, but only with BR. My site is slowly becoming a > headache. > > Can anyone help? > > > > -- > 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] another problem
I would have started with a search on php.net for "hex" which would have showed you two functions, and numerous other links that i'm not going to read. dechex() and hexdec() seem to do it for numbers, and i'm sure you'll find what you need with some more looking. Justin French on 23/07/02 6:02 PM, Georgie Casey ([EMAIL PROTECTED]) wrote: > well, i solved the last problem on my own but now i need help on my new one > :-) > > how do you convert text to hexadecimal with PHP? > > -- > Regards, > Georgie Casey > [EMAIL PROTECTED] > > *** > http://www.filmfind.tv > Online Film Production Directory > *** > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Another problem installing PHP under Solaris 8.0
you need ar. my solaris 8 install has it in /usr/ccs/bin if you have it there, make sure /usr/ccs/bin is in your PATH. if you need to know what package ar is part of let me know. joe Emiliano Marmonti([EMAIL PROTECTED])@Mon, Mar 26, 2001 at 03:12:00PM -0300: > > Dear Friends: > > I have had another problem, after succesfully find flex package > installed > in this machine and make a link to a folder that is included in PATH. > After ./configure, after the message that PHP was configured OK, following > the instructions I write: make. > > This is the error that appears > > Making all in Zend > make[1]: Entering directory '/usr/local/php-4.0.4pl1/Zend' > /bin/sh../libtool --silent --mode=link gcc -g -02 -o libZend_c.la > zend_language_scanner.lo zend_ini_scanner.lo > ../libtool: ar: not found > make[1]: *** [libZend_c.la] Error 1 > leaving directory > make[1]: *** [all- recursive] Error 1 > > I have looked at /php folder and exists a file called libtool. Anybody > knows what is the problem? > > Thank you very much > Emiliano. > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]