Re: [PHP] Basic Help
At 2003-06-16 23:39 -0400, Logan McKinley wrote: I am new to PHP but have been using ASP for years. What i am trying to do is: 1) take a querystring variable 2) set it as a session variable 3) redirect the page back on itself all of this is done so the user never sees the querystring var so it must change it address bar 4) access the session variable as a hidden form element The code that follows is code i tried to write but it doesn't seem to work --- ? $qs = ; session_start(); if($_SERVER['QUERY_STRING']!= $_Session(qs) != ) Shouldn't '$_Session()' be '$_SESSION[]'? By the way, I think it's better to surround strings that don't have to be expanded with '' instead of . Comparing for inequality with an empty string may also be superfluous. Greetings, Jaap { $_SESSION[qs] = $_SERVER['QUERY_STRING']; session_register(qs); header(Location: http://localhost/PHP/registration_form.php;); } ? ? echo $_SESSION[qs]; ? -- among other problems if there is no querystring value at all it gives me an error in the if statement Any help would be appriciated Thanks in advance ~Logan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP Books
Jaap van Ganswijk wrote: snip Some of the O'Reilly books that I thought were not perfect: - All books about Perl. Now that we have nice c-like script languages like PHP, Python and Javascript who still wants to study the mess that Perl is? snip The O'Reilly Perl books are considered to be like Perl Bibles by most Perl programmers (myself included). I may be biased, but I did some homework (as I look at the 8 non-O'Reilly Perl books on my shelf that have gathered dust for over a year now while the Camel book sits open on my desk (it's usual place)). When you look beyond the web (which Perl was never designed for), Perl is one of, if not the most powerful scripting language out there. PHP is the greatest thing to hit the web since the graphical browser, but beyond that, it can't compete with Perl. Python comes close, but Perl is just too big and global for Python to handle. And JavaScript? Well, let me just say that JavaScript handles the Microsoft IE DOM better than Perl. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Help
On Tuesday 17 June 2003 11:39, Logan McKinley wrote: Use a descriptive subject heading. I am new to PHP but have been using ASP for years. What i am trying to do is: 1) take a querystring variable 2) set it as a session variable 3) redirect the page back on itself all of this is done so the user never sees the querystring var so it must change it address bar 4) access the session variable as a hidden form element The code that follows is code i tried to write but it doesn't seem to work --- ? $qs = ; session_start(); if($_SERVER['QUERY_STRING']!= $_Session(qs) != ) ^^ A ^^ ^ B ^ A) PHP variable names are case-sensitive, $_SESSION != $_Session B) You probably want to replace the () with []. { $_SESSION[qs] = $_SERVER['QUERY_STRING']; session_register(qs); You cannot (should not) mix the use of $_SESSION with session_register(). RTFM. If you redirect without closing the session then any changes to the session variables will lost. So you need a session_write_close(). header(Location: http://localhost/PHP/registration_form.php;); } ? among other problems if there is no querystring value at all it gives me an error in the if statement Use: isset($_SESSION['qs']) or !empty($_SESSION['qs']) rather than $_Session(qs) != and similarly for $_SERVER['QUERY_STRING']. -- 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 -- /* La-dee-dee, la-dee-dah. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] functions, opinion...
On Tuesday 17 June 2003 12:50, DvDmanDT wrote: I was replying to If you don't do it this way, you'll find yourself re-writing a function sooner or later because you need it to return the data instead of displaying it Then you don't need to modify the function if you turn on ob, call function, then get contents, then clear ob... Ok, it's a rather bad way to do it, but it works for me... Even the php crew had to rewrite functions because it displayed data instead of returning. Case in point: print_r() recently had a extra argument added to specify whether the output was printed or returned. -- 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 -- /* I have learned silence from the talkative, toleration from the intolerant, and kindness from the unkind. -- Kahlil Gibran */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Multiple choices for e-cart
Hi all, I'm about to start developing the PHP and MySQL coding and designing to make a web site with hundreds or maybe thousands of products, which will be sold through the Internet (I hope :). The products (most of them) have different sizes and/or colors to choose from and each selection will have different IDs or codes. Even the same color for two different products will have two different IDs. My question is about how to design the web site, so for each product that is displayed, a different palette of colors (each with it's own image) and sizes appear for that item, letting the visitor choose from any selection. To make myself more clear, anyone who has seen an AVON magazine or has a girlfriend who want's to sell this over the Internet should know what I'm talking about. Thanks in advanced, --- Cesar Aracena [EMAIL PROTECTED] http://www.icaam.com.ar Cel: +54.299.635-6688 Tel/Fax: +54.299.477-4532 Cipolletti, Rio Negro R8324BEG Argentina --- Soluciones profesionales en Internet y Comunicaciones http://www.icaam.com.ar -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array in a $_session
On Tuesday 17 June 2003 13:23, Frank Keessen wrote: (step 3.php) ? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; You have not defined $i, so what did you expect to see here? echo $test1; for ($i=1; $i=$_SESSION['test1'][$i]; $i++) { echo $test1; $test1 hasn't changed since you assigned it above, so what did you expect to see here? } ? -- 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 -- /* Research is what I'm doing when I don't know what I'm doing. -- Wernher von Braun */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Writing GIFs with LZW compression, patch
Hi! For those impatient to wait for official inclusion, I took gd_lzw_out.c from gd1.5.tar.gz and put it in php-4.3.2. The patch for configure script is not the most beautiful one, but it works for now. In case you developers have not yet included LZW compressed GIF support, feel free to use this. http://www.iki.fi/hyvatti/sw/ http://www.iki.fi/hyvatti/sw/php-4.3.2-gif.diff Regards, Jaakko -- [EMAIL PROTECTED] http://www.iki.fi/hyvatti/+358 40 5011222 echo 'movl $36,%eax;int $128;movl $0,%ebx;movl $1,%eax;int $128'|as -o/bin/sync -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Dynamic menu not passing value to PHP?
On Tuesday 17 June 2003 05:45, Dennis Martin Ong wrote: Is there something I've missed out cos it seems like the $sltCat which is suppose to pass the selected option value when the form is submitted is not passing the correct value, So have you verified that it passes the value as expected or what? $query_rsCat = SELECT * FROM inventory WHERE category='$sltCat' OR item_name LIKE '%$txtSearch%'; And have you checked that $query_rsCat contains what you expected it to contain? -- 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 -- /* Sometimes, when I think of what that girl means to me, it's all I can do to keep from telling her. -- Andy Capp */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array in a $_session
Hi Jason, Maybe you can make it a little bit clear for me? You have not defined $i, so what did you expect to see here? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; So is it going to be: $test1[$i ]= $_SESSION['test1'][$i]; ??? Regards, Frank On Tuesday 17 June 2003 13:23, Frank Keessen wrote: (step 3.php) ? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; You have not defined $i, so what did you expect to see here? echo $test1; for ($i=1; $i=$_SESSION['test1'][$i]; $i++) { echo $test1; $test1 hasn't changed since you assigned it above, so what did you expect to see here? } ? -- 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 -- /* Research is what I'm doing when I don't know what I'm doing. -- Wernher von Braun */ -- 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] Multiple choices for e-cart
ok each product could have a category but also a group attatched to it, so each group red, blue, green has an id so each product is joined to a group with the primary key of the group like products.php?productID=1groupID=1 for red products.php?productID=1groupID=2 for blue etc ... and for getting categories products.php?catID=1 etc .. hope this helps Hi all, I'm about to start developing the PHP and MySQL coding and designing to make a web site with hundreds or maybe thousands of products, which will be sold through the Internet (I hope :). The products (most of them) have different sizes and/or colors to choose from and each selection will have different IDs or codes. Even the same color for two different products will have two different IDs. My question is about how to design the web site, so for each product that is displayed, a different palette of colors (each with it's own image) and sizes appear for that item, letting the visitor choose from any selection. To make myself more clear, anyone who has seen an AVON magazine or has a girlfriend who want's to sell this over the Internet should know what I'm talking about. Thanks in advanced, --- Cesar Aracena [EMAIL PROTECTED] http://www.icaam.com.ar Cel: +54.299.635-6688 Tel/Fax: +54.299.477-4532 Cipolletti, Rio Negro R8324BEG Argentina --- Soluciones profesionales en Internet y Comunicaciones http://www.icaam.com.ar -- 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] Array in a $_session
On Tuesday 17 June 2003 14:48, [EMAIL PROTECTED] wrote: Maybe you can make it a little bit clear for me? I can't because I don't know what you're trying to do. I can only point out what I see [to me] are obvious mistakes. You have not defined $i, so what did you expect to see here? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; So is it going to be: $test1[$i ]= $_SESSION['test1'][$i]; ??? A general rule: it is pointless (in most cases) to assign values from the superglobals (such as $_SESSION) to other variables. Just work with them directly. Trivial example: Instead of: $firstname = $_SESSION['firstname']; $lastname = $_SESSION['lastname']; echo Hello $firstname $lastname; Just do: echo Hello {$_SESSION['firstname']} {$_SESSION['lastname']}; -- 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 -- /* The only difference between a rut and a grave is their dimensions. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP Books
At 2003-06-17 01:16 -0500, John Nichel wrote: Jaap van Ganswijk wrote: snip Some of the O'Reilly books that I thought were not perfect: - All books about Perl. Now that we have nice c-like script languages like PHP, Python and Javascript who still wants to study the mess that Perl is? snip The O'Reilly Perl books are considered to be like Perl Bibles by most Perl programmers (myself included). I have 'Perl in a Nutshell' as part of the Perl CD-Bookshelf (which has about 5 more books on CD). And I have the Perl 5 Pocket Reference in Dutch, and yes the books are of the to-be-expected O'Reilly quality, as far as I have read them, but why did Perl ever become a standard and who still needs it? It probably became a standard because the designers of compiled languages recognized too late that because of the increased speed and memory of computers the interpreted languages became a viable option (again). And Perl was probably indeed a lot more powerful than the commands built into the shells, but already the designers of the c-shell realized that some more c-like structure wouldn't hurt the programming language of a shell. In Perl however everything was solved as ad-hoc as possible. As soon as a new 'problem' occured, Larry Wall found another combination of weird characters to denote it and so he created exception upon exception. It's not strange that programmers need stacks of 'bibles' to program in Perl, whereas you only need to read through the introduction of the PHP manual once to understand the language. After that, most time is being spend on understanding the principle of interactive HTTP-based programming and on getting to understand all the library functions (like in many languages). I may be biased, but I did some homework (as I look at the 8 non-O'Reilly Perl books on my shelf that have gathered dust for over a year now while the Camel book sits open on my desk (it's usual place)). When you look beyond the web (which Perl was never designed for), Perl was never really designed. Good designs are as simple as possible and orthogonal. Perl is one of, if not the most powerful scripting language out there. How do you define powerful? Being able to denote with only a few weird characters a complete program? I can design a language in which you can write a program which consists of only a '.' and it will handle a database, build a robot for you that cleans out your refrigerator and picks up the phone. But how flexible will the programming language be? Is it possible to write a ',' instead of a '.' and will it be a perfect CAD-CAM program with which you can also access the IRC? Or is a good language such that it has no more elements and concepts than needed whereby all elements are orthogonal and are all combinable to provide real expression power. PHP is the greatest thing to hit the web since the graphical browser, but beyond that, it can't compete with Perl. It's in the mean time perfectly possible to write normal command line interface (CLI) PHP scripts. I'm thinking about replacing a lot of the written-in-C compiler-like applications with which I compile my 30 Mbyte WWW site about chips with PHP-written scripts. The string handling is much better than in C. In another thread someone asked if functions should output data directly to the standard output or only return it in string form. This is one of the problems with my c-written code: It usually outputs directly to some sort of output stream but it would be much more flexible if all functions returned strings, so the output could be redirected via filters etc. Python comes close, I like Python too. but Perl is just too big and global for Python to handle. But serious programmers never programmed in Perl. It was much more the language for system and network managers that had no formal programming education and quickly had to fix things. As with Forth it's very hard even to read back ones own script after a couple of days let alone the programs of others. I can easily read back C programs I wrote 10 years ago and immediately understand what they do. And JavaScript? Well, let me just say that JavaScript handles the Microsoft IE DOM better than Perl. I was talking about Javascript as a language. Of course it's power is very limited since it has to be safe enough so hosts can send it to the client's browser to be executed. The language itself is very nice though. By the way, I think there should be only one language and depending on the circumstances more or fewer of the constructs and standard functions in it would be allowed. There should ideally also be only one set of libraries. Greetings, Jaap -- Chip Directory -- http://www.chipdir.biz/ -- http://www.chipdir.info/ -- http://www.chipdir.net/ -- http://www.chipdir.nl/ -- http://www.chipdir.org/ -- And about 30 other mirror sites world-wide. -- -- To subscribe to a free 'chip issues, questions and answers' -- mailing list, send a message to [EMAIL PROTECTED] with -- in
[PHP] magic_quotes_gpc - 4.0.1 to 4.3.1
Hi List Is there a difference in the way PHP handles the magic_quotes_gpc between these versions? I had 4.0.1 running on my server for a little over a year and all went well, ie, data that contained quotes etc were discreetly handles by PHP and inserted into MySQL with no problems ( when you vies the data in the table with phpMyAdmin for instance, you would not see any slashes in the content. However, since I upgraded to 4.3.1 (and turned on magic_quotes_gpc), I notice that the same process now produces slashes in the db, meaning that I will now need to edit my code and add stripslashes() when I need to display them. [STOP RIGHT HERE] - I KNOW that it is best to use addslashes() and stripslashes() BUT, I inherited the code, and it is really going to be an enormous task to go through the code for the entire app. So naturally I'm looking for a quick fix in the form of another magic function, and in the absence of such a function, I'd like to know what the differences are, maybe I can then look at a class or a function to handle all for me??? Thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing GIFs with LZW compression, patch
At 2003-06-17 09:31 +0300, Jaakko Hyvätti wrote: For those impatient to wait for official inclusion, I took gd_lzw_out.c from gd1.5.tar.gz and put it in php-4.3.2. The patch for configure script is not the most beautiful one, but it works for now. In case you developers have not yet included LZW compressed GIF support, feel free to use this. http://www.iki.fi/hyvatti/sw/ http://www.iki.fi/hyvatti/sw/php-4.3.2-gif.diff I may have missed the latest developments, but I thought that Unisys was still trying to collect licensing fees for the use of the encryption part of the LZW algorithm. I noticed however that GIMP in Mandrake 9.0 can generate .gif files, so I'm not sure. By the way, I would expect PHP to be able to read .gif files but not write them. You'd have to use .png instead. Greetings, Jaap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP Books (topic wandering)
Some of the O'Reilly books that I thought were not perfect: - All books about Perl. Now that we have nice c-like script languages like PHP, Python and Javascript who still wants to study the mess that Perl is? Heh. PHP, Python, Javascript? It's all perl to me. ;-) The O'Reilly books, as has been noted, are the standard references on perl. - The introduction to Ruby, probably called Ruby in a Nutshell. I had read the introductory article in DrDobbs by the author of the language and the language seemed nice, but whilst reading the book I noticed more and more cases of half-Perl ugliness. The language Ruby was designed by a Japanese and a lot of Japanese designs are flawed by being a seemingly random combination of aspects from Western designs. Ruby is also a dialect of perl, and very well done. You might want to take a closer look at what seems random to you now. But it seems to me you are criticizing languages rather than books in the above. - The Java in a Nutshell book. It consisted mainly of a collection of standard library functions but with to few details to be of any use. Java is a huge language and full of details. Once I got used to Java, O'Reilly's Java in a Nutshell turned out to be just right to have on my desk. The Examples volume is a necessity. PHP's on-line docs are great because PHP is small and glosses over a lot of details. Sun's on-line docs for Java just don't work as primary source because you have to see too much through that itty-bitty seventeen inch screen. (When monitors are 600dpi, and cheap and thin enough that we can have seven or eight of them sitting on our desk, then maybe we can finally get rid of books.) I propose that when looking for a book on a certain subject: - You check out if there is an O'Reilly book about it and when not, why not? - Compare any other book you encounter with the O'Reilly book and see if it is better. It might happen in selected cases. That's probably not a bad approach. By the way, I think that the online PHP-manual at php.net is very good so I have no need for a PHP book, No argument with that. except that I once bought O'Reilly's PHP Kort en Krachtig (the Dutch translation of the PHP Pocket Reference, probably the first version of 2000). Of course I would have bought the English version if it had been in stock here. The Dutch translations of computer books are often very flawed, plus that it's useful to learn the English terms. I imagine things will improve with Dutch. Japanese docs have definitely been improving -- less reliance on technical words borrowed from English, greater accuracy when choosing native terminology, less Janglish grammar. -- Joel Rees [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] functions, opinion...
Depends on the use of the function. (Output functions should produce output shouldn't they?!) Best option probably is to specifiy an argument that allows to choose wether to output or to return. If you return text you should return by reference to prevent unnecessary memory consumption. Regards Stefan Langer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Writing GIFs with LZW compression, patch
On Tuesday 17 June 2003 15:51, Jaap van Ganswijk wrote: I may have missed the latest developments, but I thought that Unisys was still trying to collect licensing fees for the use of the encryption part of the LZW algorithm. The US patent expires later this week: http://www.unisys.com/about__unisys/lzw/ -- 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 -- /* I've finally learned what `upward compatible' means. It means we get to keep all our old mistakes. -- Dennie van Tassel */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Good PHP Books (topic wandering)
I stick with the Wrox publications : for me 'Professional PHP' and 'Beginning PHP Databases' (with very good section about the DB class in PEAR) serve me in almost all my needs. The online manual though serves about 95 % of my queries. -Oorspronkelijk bericht- Van: Joel Rees [mailto:[EMAIL PROTECTED] Verzonden: Tuesday, June 17, 2003 9:57 AM Aan: [EMAIL PROTECTED] Onderwerp: Re: [PHP] Good PHP Books (topic wandering) Some of the O'Reilly books that I thought were not perfect: - All books about Perl. Now that we have nice c-like script languages like PHP, Python and Javascript who still wants to study the mess that Perl is? Heh. PHP, Python, Javascript? It's all perl to me. ;-) The O'Reilly books, as has been noted, are the standard references on perl. - The introduction to Ruby, probably called Ruby in a Nutshell. I had read the introductory article in DrDobbs by the author of the language and the language seemed nice, but whilst reading the book I noticed more and more cases of half-Perl ugliness. The language Ruby was designed by a Japanese and a lot of Japanese designs are flawed by being a seemingly random combination of aspects from Western designs. Ruby is also a dialect of perl, and very well done. You might want to take a closer look at what seems random to you now. But it seems to me you are criticizing languages rather than books in the above. - The Java in a Nutshell book. It consisted mainly of a collection of standard library functions but with to few details to be of any use. Java is a huge language and full of details. Once I got used to Java, O'Reilly's Java in a Nutshell turned out to be just right to have on my desk. The Examples volume is a necessity. PHP's on-line docs are great because PHP is small and glosses over a lot of details. Sun's on-line docs for Java just don't work as primary source because you have to see too much through that itty-bitty seventeen inch screen. (When monitors are 600dpi, and cheap and thin enough that we can have seven or eight of them sitting on our desk, then maybe we can finally get rid of books.) I propose that when looking for a book on a certain subject: - You check out if there is an O'Reilly book about it and when not, why not? - Compare any other book you encounter with the O'Reilly book and see if it is better. It might happen in selected cases. That's probably not a bad approach. By the way, I think that the online PHP-manual at php.net is very good so I have no need for a PHP book, No argument with that. except that I once bought O'Reilly's PHP Kort en Krachtig (the Dutch translation of the PHP Pocket Reference, probably the first version of 2000). Of course I would have bought the English version if it had been in stock here. The Dutch translations of computer books are often very flawed, plus that it's useful to learn the English terms. I imagine things will improve with Dutch. Japanese docs have definitely been improving -- less reliance on technical words borrowed from English, greater accuracy when choosing native terminology, less Janglish grammar. -- Joel Rees [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Difference between $_POST[foo] and $_POST['foo']?
Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
the first will generate a warning if warnings are enabled. it could mean a constant or a string, if a constant with that name is not available php will use it as a string and show a warning. the second is right as a string. Thomas On Tue, 17 Jun 2003 11:09:14 +0300 [EMAIL PROTECTED] (Jarmo Järvenpää) wrote: Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array in a $_session
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 17 June 2003 07:48 Maybe you can make it a little bit clear for me? You have not defined $i, so what did you expect to see here? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; So is it going to be: $test1[$i ]= $_SESSION['test1'][$i]; ??? No. This is worse than before. You still have not defined what $i is -- it has no value, it is unset, it is equivalent to NULL. Therefore, $_SESSION['test1'][$i] is unlikely to return anything meaningful. At least before you were putting unknown result into a known location ($test1) -- but now you're trying to assign it to another non-meaningful place ($test1[$i], which is an unknown quantity because $i is still undefined!). 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] functions, opinion...
On Mon, 2003-06-16 at 23:20, Jason Wong wrote: On Tuesday 17 June 2003 12:50, DvDmanDT wrote: I was replying to If you don't do it this way, you'll find yourself re-writing a function sooner or later because you need it to return the data instead of displaying it Then you don't need to modify the function if you turn on ob, call function, then get contents, then clear ob... Ok, it's a rather bad way to do it, but it works for me... Even the php crew had to rewrite functions because it displayed data instead of returning. Case in point: print_r() recently had a extra argument added to specify whether the output was printed or returned. I agree with your point, but the adding of the second argument was more of a convenience thing than an admission that printing when calling a print statement was bad behaviour. :) Besides, it's more consistent since the introduction of var_export() with its similar abilities. As to your actual point (no more hair splitting): I agree. If the function has something to say, it's better to store that somehow and then use it when you need it. You get to determine when (and if) it gets output, and how. As someone else noted, you will sometimes find it necessary to break this rule (quick debugging statements, or functions whose purpose is to actually output something), but in general I wouldn't expect to see any benefit to having your functions doing their own output--beyond the initial convenience. For one thing, it can make effective use of templates a bloody pain. Just some thoughts, Torben -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Email Valadation
How would i valadate an email string to see if it has invalid charactors? / Philip
Re: [PHP] Email Valadation
On Tue, 2003-06-17 at 02:42, Philip J. Newman wrote: How would i valadate an email string to see if it has invalid charactors? / Philip Read RFC 822 and grok it thoroughly. Then decide exactly how lax you can afford to be in your checking, or find a checker to download-- because unless you crave the challenge it's probably easier to either do a really simple check, or just download a checker. It's a much harder question than it sounds like. For a couple of perl examples of how it can be done, check here: http://examples.oreilly.com/regex/readme.html I would suggest checking on ps.sklar.com, Zend.com, phpclasses.org, etc for some rfc822 checkers. -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Email Valadation
On Tue, 2003-06-17 at 02:54, Lars Torben Wilson wrote: [snip] I would suggest checking on ps.sklar.com, Zend.com, phpclasses.org, etc for some rfc822 checkers. I meant 'px.sklar.com', of course. :/ Torben -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password generator
On Tue, 2003-06-17 at 02:45, Davy Obdam wrote: Hi people, I have to make a password generator, but i have a little problem. - It needs to generate password 8 characters long, and including 1 or 2 special characters(like #$%*@). - Those special characters can never appear as the first or last character in the string... anywhere between is fine. I have a password generator script now that does the first thing... but the special character can be in front or back of the string wich it shouldnt.. i have been looking on the web for this but i havent found the answer. Below is my scripts so far.. Any help is appreciated, thanks for your time, Best regards, Davy Obdam Please don't crosspost. Pick the suitable list (in this case, it would have been php-general). Anyway, just tell it not to use anything beyone the first 26 characters of your allowable characters string. Below is one way to do it. Good luck, Torben ?php error_reporting(E_ALL); ini_set('display_errors', true); // A function to generate random alphanumeric passwords in PHP // It expects to be passed a desired password length, but it // none is passed the default is set to 8 (you can change this) function generate_password($length = 8) { // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 $allowable_characters = 'abcdefghefghijklmnopqrstuvwxyz0123456789%#*'; // We see how many characters are in the allowable list $ps_len = strlen($allowable_characters); // Max index of the characters allowed to stand and end the output. $max_endpoint_ind = 25; // 0-based index of the last char of the output $last_char = $length - 1; // Seed the random number generator with the microtime stamp // (current UNIX timestamp, but in microseconds) mt_srand((double)microtime() * 100); // Declare the password as a blank string. $pass = ; // Loop the number of times specified by $length for($i = 0; $i $length; $i++) { // Each iteration, pick a random character from the // allowable string and append it to the password. switch ($i) { case 0: case $last_char: $pass .= $allowable_characters{mt_rand(0, $max_endpoint_ind)}; break; default: $pass .= $allowable_characters{mt_rand(0, $ps_len)}; } } // Retun the password we've selected return $pass; } for ($i = 0; $i 100; $i++) { echo generate_password() . \n; } ? -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PhpMyAdmin / MySQL
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hello All, I am using phpMyAdmin to administer my MySQl DB. I am running Mac OS Jaguar. when I try to start up phpMyAdmin I get an error: Welcome to phpMyAdmin 2.4.0 Error MySQL said: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) So I try to start up the MySQL Server manually by typing the following on my command prompt: and here are the results: [psg:/usr/local/mysql] psgarcha% sudo ./bin/mysqld_safe [1] 558 [psg:/usr/local/mysql] psgarcha% Starting mysqld daemon with databases from /usr/local/mysql/data 030616 10:16:32 mysqld ended Please help. Thanks in advance. Does the mysql log tell you anything useful? -- Quod subigo farinam $email =~ s/oz$/au/o; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
At 12:42 17-6-03, you wrote: the first will generate a warning if warnings are enabled. it could mean a constant or a string, if a constant with that name is not available php will use it as a string and show a warning. the second is right as a string. in addition to that. In your example the array key is a string. 'foo' is a string. (if $string_a='foo'; ) $string_a is a string foo is not a string but after define('foo','stringvalue');, foo is a CONSTANT with a string value. see http://www.php.net/define If you type $_POST[foo] in a piece of code, PHP recognizes that foo is not a normal string such as 'foo', and not a variable as it does not have a $. So then PHP checks its definition-list to see if 'foo' is defined. If not, PHP will issue a warning (if turned on) that says something like i assume you mean 'foo') and uses the string 'foo' as key. This is extra work for PHP and should be avoided, although you see it a lot. There is one confusing exception: within double quotes strings, you may use array keys without the quotes. For example like $_POST[foo];. If you can, I recommend using 'For example like '.$_POST['foo']. Last one: $_POST[foo] is ok too but now PHP will first check the string foo for possible variables inside: (a little bit of ) extra work that is not there with single quotes ($_POST['foo']). Thomas On Tue, 17 Jun 2003 11:09:14 +0300 [EMAIL PROTECTED] (Jarmo Järvenpää) wrote: Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- 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] Dynamic menu not passing value to PHP?
Got it sorted out now $query_rsCat = SELECT * FROM inventory WHERE category='$sltCat' OR item_name LIKE '%$txtSearch%'; This will select all the items if either $sltCat or $txtSearch is empty. Janet '%$txtSearch%' would always evaulate as '%%' in Mysql when the txtSearch field is empty thus resulting in Mysql selecting everything in the database making the the category='$sltCat' redundant... I've rewritten it as: if(empty($txtSearch)){ $query_rsCat= SELECT * FROM inventory WHERE category='$sltCat'; } else { $query_rsCat=SELECT * FROM inventory WHERE item_name LIKE '%$txtSearch%'; } to circumvent this and it worked.. Thanks Janet for pointing this out...and thanks all for the help Dennis Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 June 2003 05:45, Dennis Martin Ong wrote: Is there something I've missed out cos it seems like the $sltCat which is suppose to pass the selected option value when the form is submitted is not passing the correct value, So have you verified that it passes the value as expected or what? $query_rsCat = SELECT * FROM inventory WHERE category='$sltCat' OR item_name LIKE '%$txtSearch%'; And have you checked that $query_rsCat contains what you expected it to contain? -- 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 -- /* Sometimes, when I think of what that girl means to me, it's all I can do to keep from telling her. -- Andy Capp */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Difference between $_POST[foo] and $_POST['foo']?
on 17/06/03 6:09 PM, Jarmo Järvenpää ([EMAIL PROTECTED]) wrote: Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. $_POST[foo] will look for a pre defined constant foo. Under certain error-reporting levels, this will generate an notice/warning, and it assumes you mean 'foo'. $_POST['foo'] is correct, and will not generate errors. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Array in a $_session
Dear all, Finnaly managed it (it's working! :)... But can you check if this is the way? (step1.php) ? $_REQUEST[submit]=isset($_REQUEST[submit])?$_REQUEST[submit]:; if($_REQUEST['submit']!=) { session_start(); $_SESSION['test1'] = array(); $_SESSION['test1'] = $_POST['test1']; session_write_close(); header(Location: step4.php); } ? form name=form1 method=post id=form1 enctype=multipart/form-data action=?=$_SERVER['PHP_SELF']? ? for ($i=1; $i=4; $i++) { ? table width=50% border=0 cellpadding=5 trReiziger ? echo $i; ? tdVoorletters/td /tr tr td? echo input type=\text\ name=\test1[$i]\ size=\6\br; ?/td /tr /table ? } ? input type=submit name=submit value=submit /form (STEP4.PHP) ?php session_start(); $_SESSION['test1'] = array_merge($_SESSION['test1'], $_POST['test1']); foreach($_SESSION['test1'] as $test1) echo $test1, 'br'; ? Regards, Frank -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 17 June 2003 07:48 Maybe you can make it a little bit clear for me? You have not defined $i, so what did you expect to see here? session_start(); $aantalpers=$_SESSION[aantalpers]; $test1 = $_SESSION['test1'][$i]; So is it going to be: $test1[$i ]= $_SESSION['test1'][$i]; ??? No. This is worse than before. You still have not defined what $i is -- it has no value, it is unset, it is equivalent to NULL. Therefore, $_SESSION['test1'][$i] is unlikely to return anything meaningful. At least before you were putting unknown result into a known location ($test1) -- but now you're trying to assign it to another non-meaningful place ($test1[$i], which is an unknown quantity because $i is still undefined!). Cheers! Mike -- 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] shopping cart and login system
Actually you can do it the way you suggest. I'm in the process of doing it also. I have yet to test the system but it should work provided that you follow the PayPal system, I already have my cart working so I think I just need another form like this one with the PHP variables as carried from my previous cart session. Should be easy by the looks of it. (watch for wrap): http://www.paypal.com/cgi-bin/webscr?cmd=_help-exteloc=762unique_id=02 413source_page=_homeflow= Steve Jackson Web Development and Marketing Manager Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: electroteque [mailto:[EMAIL PROTECTED] Sent: 15. kesäkuuta 2003 6:33 To: olinux; Jeff Harris Cc: Php-General Subject: RE: [PHP] shopping cart and login system yes i know about that but then the whole basket/cart system is out of your hands i prefer to send the total with the products and quantities or can you not do that ? if not i guess adding the individual items to their basket is the only way the IPN system is confusing aswell :| -Original Message- From: Jeff Harris [mailto:[EMAIL PROTECTED] Sent: Sunday, June 15, 2003 1:31 PM To: olinux Cc: electroteque; Php-General Subject: Re: [PHP] shopping cart and login system On Jun 14, 2003, olinux claimed that: |hi | |--- electroteque [EMAIL PROTECTED] wrote: | hi there , i am about to build a shopping cart which | will interact with a | paypal payment system , the cart will use sessions | to store the items and | basket information before checking out and posting | to the paypal form , what | i'd like to know is would the cart require a login | system to track users and | to prevent ppl from making dodgy orders , | |if pure simplicity is a goal, i dont think you need a |login for customers. who cares if they add items and |then dont purchase. obviously they would not be able |to log in again to see the previous orders or current |order status but you could always implement later. Actually, to be more simple, for paypal paying customers, I would use paypal's buy it now buttons. Let them deal with the shopping carts and sessions. http://www.paypal.com/cgi-bin/webscr?cmd=p/xcl/rec/singleitem- intro-outside -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- 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] Password generator
Thanks Lars and ofcourse all the other people who answerd. It works great!! Best regards, Davy Obdam Lars Torben Wilson wrote: On Tue, 2003-06-17 at 02:45, Davy Obdam wrote: Hi people, I have to make a password generator, but i have a little problem. - It needs to generate password 8 characters long, and including 1 or 2 special characters(like #$%*@). - Those special characters can never appear as the first or last character in the string... anywhere between is fine. I have a password generator script now that does the first thing... but the special character can be in front or back of the string wich it shouldnt.. i have been looking on the web for this but i havent found the answer. Below is my scripts so far.. Any help is appreciated, thanks for your time, Best regards, Davy Obdam Please don't crosspost. Pick the suitable list (in this case, it would have been php-general). Anyway, just tell it not to use anything beyone the first 26 characters of your allowable characters string. Below is one way to do it. Good luck, Torben ?php error_reporting(E_ALL); ini_set('display_errors', true); // A function to generate random alphanumeric passwords in PHP // It expects to be passed a desired password length, but it // none is passed the default is set to 8 (you can change this) function generate_password($length = 8) { // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 $allowable_characters = 'abcdefghefghijklmnopqrstuvwxyz0123456789%#*'; // We see how many characters are in the allowable list $ps_len = strlen($allowable_characters); // Max index of the characters allowed to stand and end the output. $max_endpoint_ind = 25; // 0-based index of the last char of the output $last_char = $length - 1; // Seed the random number generator with the microtime stamp // (current UNIX timestamp, but in microseconds) mt_srand((double)microtime() * 100); // Declare the password as a blank string. $pass = ; // Loop the number of times specified by $length for($i = 0; $i $length; $i++) { // Each iteration, pick a random character from the // allowable string and append it to the password. switch ($i) { case 0: case $last_char: $pass .= $allowable_characters{mt_rand(0, $max_endpoint_ind)}; break; default: $pass .= $allowable_characters{mt_rand(0, $ps_len)}; } } // Retun the password we've selected return $pass; } for ($i = 0; $i 100; $i++) { echo generate_password() . \n; } ? -- --- Davy Obdam Web application developer Networking4all email: [EMAIL PROTECTED] email: [EMAIL PROTECTED] internet: http://www.networking4all.com --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Mail() problem
Hi Don, ?php $cmd='/bin/sh -c set'; passthru($cmd); echo 'P'; putenv(REMOTE_ADDR=$REMOTE_ADDR); passthru($cmd); echo 'P'; ? This code will work, but I want to be able to enforce it on people that use the mail() function. I want php to call sendmail (The one from php.ini that is) WITH this environment variabele still set. Maybe my initial post wasn't that clear on this :) Don Read [EMAIL PROTECTED] Kind regards, Maikel Verheijen.
[PHP] trigger download with left-click?
Hi, I have a site with hundreds of downloadable forms in MS Word format. Right now to download a form you have to right-click and choose Save Target As... to download the form. Is there a simple script that I could put in that would trigger the download with a left-click? (The end users are not very savy and are having a hard time with the Save target as... concept). Thanks for your help, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trigger download with left-click?
Provide a download link which would link to a download.php file. In this file output header('Content-type: application/octet-stream'); and then readfile(); the desired file. REMEMBER to check if it is realy a file that the user can see, otherwise anybody can download your php scripts (and maybe even other files) too. Sam Folk-Williams wrote: Hi, I have a site with hundreds of downloadable forms in MS Word format. Right now to download a form you have to right-click and choose Save Target As... to download the form. Is there a simple script that I could put in that would trigger the download with a left-click? (The end users are not very savy and are having a hard time with the Save target as... concept). Thanks for your help, Sam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Building a save photo album
Hi People I need to build a secure photo album, in a way where only some autenticated users can see the images and the images thumbnails. Some people have given idear to put the images/file directory outside of the web server documents, but how can i then insert the images thumbnails on html page... similar toimage=/somepath/my_image_preview.jgp How can i do this ? or is there any other thing that i can do under php to prevent this ? Thankx people Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem to start apache after installed PHP.
sounds like something was not initialized during your linux boot up I havent run linux in a while but I seem to remember that after I compile my applications I had to run another utility to make my new library active. In fact the same utility is/was part of my boot up commands in the RC files. gr for some reason i keep thinking ldconfig but I dont think thats it. The utility updates a library table. sorry if this is still unclear... Niklas Janzon [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi .. i got a problem to restart my apache (2.0.46) server on my linux system after i installed PHP 4.3.2. I get this message: [EMAIL PROTECTED]:/usr/local/apache2/bin/ ./apachectl restart Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/libexec/libphp4.so into server: /usr/libexec/libphp4.so: undefined symbol: ap_block_alarms Anyone got any idea on this? Kind regards Niklas Janzon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] preg_replace problem
Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole** word into a string. For example: I want A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz ladder. I **don't** want: A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz lxyza/xyzdder. You understand what I mean? I can't do that will str_replace, but I know it would be quite easy with preg_replace. Can someone help me? Thanks Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Building a save photo album
Hi Again, I forgot to informe you, i already have the user autentication part working ok, i know if the user has permissions to view/user something via one serialized variable which defines is running permissions, and the user is autenticated using a mysql database Thankx again Hi People I need to build a secure photo album, in a way where only some autenticated users can see the images and the images thumbnails. Some people have given idear to put the images/file directory outside of the web server documents, but how can i then insert the images thumbnails on html page... similar toimage=/somepath/my_image_preview.jgp How can i do this ? or is there any other thing that i can do under php to prevent this ? Thankx people Miguel Angelo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trigger download with left-click?
On Tue, 17 Jun 2003 06:00:28 -0500, you wrote: I have a site with hundreds of downloadable forms in MS Word format. Right now to download a form you have to right-click and choose Save Target As... to download the form. Is there a simple script that I could put in that would trigger the download with a left-click? (The end users are not very savy and are having a hard time with the Save target as... concept). header(Content-Disposition: attachment; filename=myfile.doc); http://www.faqs.org/rfcs/rfc2183 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace problem
You need \b = word boundary. $string=preg_replace(/\\b($word)\\b/i,'xyz\1/xyz', $string); Vincent Bouret wrote: Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole** word into a string. For example: I want A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz ladder. I **don't** want: A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz lxyza/xyzdder. You understand what I mean? I can't do that will str_replace, but I know it would be quite easy with preg_replace. Can someone help me? Thanks Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_replace problem
Hello, ?php $parsed = preg_replace(/(\ba\b)/i,tag\\1/tag,$sourcestring); ? should do the job. regards Am Die, 2003-06-17 um 13.25 schrieb Vincent Bouret: Hi, I am having this problem with preg_replace. I want the following thing but I can't understand what regular expression I should put. I want to replace all occurences of a given **whole** word into a string. For example: I want A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz ladder. I **don't** want: A dog jumped over a ladder to become xyzA/xyz dog jumped over xyza/xyz lxyza/xyzdder. You understand what I mean? I can't do that will str_replace, but I know it would be quite easy with preg_replace. Can someone help me? Thanks Vincent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trigger download with left-click?
on 17/06/03 9:00 PM, Sam Folk-Williams ([EMAIL PROTECTED]) wrote: I have a site with hundreds of downloadable forms in MS Word format. Right now to download a form you have to right-click and choose Save Target As... to download the form. Is there a simple script that I could put in that would trigger the download with a left-click? (The end users are not very savy and are having a hard time with the Save target as... concept). Save target as is really the only option... I'd consider it a privacy issue otherwise (you could end up with all sorts of sh*t on your HDD otherwise)... unless their browser is set-up to automatically save certain mime types... Different browser behave differently... left-click isn't even an option for some users (macs and PDA's (?) are just one example)... My suggestion is to provide a help file on the topic... downloading files is pretty basic... Or, do they really need to download? Why can't you just create a HTML version of the doc, display it in the browser, and let them choose save page as... from the browser menu. Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form Elements - user adding dynamically
I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. Thanks, Nelson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Help
You say to RTFM, are there any good resources for new users? I know PHP.net has an extensive manual but a tutorial or a list of commonly used features/functions and there uses would be better for me. I need to learn about database connectivity in particular and unfortunately I must use ACCESS as my back end. Thanks in advance, ~Logan Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tuesday 17 June 2003 11:39, Logan McKinley wrote: Use a descriptive subject heading. I am new to PHP but have been using ASP for years. What i am trying to do is: 1) take a querystring variable 2) set it as a session variable 3) redirect the page back on itself all of this is done so the user never sees the querystring var so it must change it address bar 4) access the session variable as a hidden form element The code that follows is code i tried to write but it doesn't seem to work --- ? $qs = ; session_start(); if($_SERVER['QUERY_STRING']!= $_Session(qs) != ) ^^ A ^^ ^ B ^ A) PHP variable names are case-sensitive, $_SESSION != $_Session B) You probably want to replace the () with []. { $_SESSION[qs] = $_SERVER['QUERY_STRING']; session_register(qs); You cannot (should not) mix the use of $_SESSION with session_register(). RTFM. If you redirect without closing the session then any changes to the session variables will lost. So you need a session_write_close(). header(Location: http://localhost/PHP/registration_form.php;); } ? among other problems if there is no querystring value at all it gives me an error in the if statement Use: isset($_SESSION['qs']) or !empty($_SESSION['qs']) rather than $_Session(qs) != and similarly for $_SERVER['QUERY_STRING']. -- 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 -- /* La-dee-dee, la-dee-dah. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] functions, opinion...
Hi, My personal opinion, which shows in all my code writing is to never echo inside a function. always return the data whether it be string, array, or boolean... I've always left echoing up to the actual page showing the data. That way if you have two seperate pages that need to display the data differently, you can use the same function, and just format it as needed on the pages. This is kind of what I thought would be the majority of the responses. I've found that since the inception of web languages (ASP, PHP, etc) that I've abused functions a bit. I then got to thinking one day that maybe what I was doing was normal, but then I figured that it probably wasn't. At times it seems like it caused me to scramble all my logic. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] functions, opinion...
Hi, Depends on the use of the function. (Output functions should produce output shouldn't they?!) Best option probably is to specifiy an argument that allows to choose wether to output or to return. If you return text you should return by reference to prevent unnecessary memory consumption. Recently, I have been doing more of returning than echoing from inside a function. I found it more useful I guess. Seems the general consensus is to simply keep the echoing from the functions most of the time, and in some minor cases, use it. To me, this makes sense. Thanks all for your opinions. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Elements - user adding dynamically
At 15:04 17-6-03, you wrote: I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. If the # of phone numbers is limited, then i think i would just make say 10 phone fields in the database, and only show the non-empty ones. Simply wander through the query results (phone1, phone2 etc) and do not show the empty ones. Let the [+] button open an edit childwindow with the first empty available phone field. Or very nice: use DHTML to do it. If the # of phone numbers is unlimited, you can chose: throw all numbers in one field, with delimiters between them, and split them when you are using them, or use an array (use The relational database choice would be to have a separate table 'phone numbers' with a field userID and a filed phone: userID | phone 1 | 1113456798 1 | 98709321 2 | 0293720973 1 | 398731273 14 | 92827981398 14 | 938721 etc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] REGEX Question
I need to match text between two html comment tags. I'm using: preg_match(/!--start_tag--(.*)!--end_tag--/, $data, $Match) Which work fine until I have carriage returns. The following doesn't match: !--start_tag-- Nullam auctor pellentesque sem. Aenean semper. Aenean magna justo, rutrum et, consequat a, vehicula non, arcu. Mauris cursus vulputate pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.!--end_tag-- Appreciate you help. == Ron Dyck Webbtech.net == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
A side question along with this ,,, how can I include $_POST['foo'] in the : $sql =select * from db where apple = '$_POST['foo']' ; without getting an error ?? should I append it as $var= $_POST['foo']; before??? Thnx Nabil Jarmo Järvenpää [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
$sql = 'select * from db where apple = \'' . $_POST['foo'] . '\';'; Like that? On Tue, 2003-06-17 at 10:09, nabil wrote: A side question along with this ,,, how can I include $_POST['foo'] in the : $sql =select * from db where apple = '$_POST['foo']' ; without getting an error ?? should I append it as $var= $_POST['foo']; before??? Thnx Nabil Jarmo Jrvenp [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi A quickie, how does the $_POST[foo] and $_POST['foo'] differ? Both do work. BR, Jarmo -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Elements - user adding dynamically
You can use DOM: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Strict//EN html head titleAny number you like/title script language=JavaScript1.2 function newNumber(f) { var newfile=document.createElement(input); newfile.setAttribute(type,text); newfile.setAttribute(name,number[]); f.appendChild(newfile); } /script /head body pre ?php print_r($_POST); ? /pre form action=subory.php method=post enctype=multipart/form-data input type=submit input type=button value=More onClick=newNumber(this.form); /form /body /html Nelson Goforth wrote: I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. Thanks, Nelson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REGEX Question
. matches any character except newline by default, use s modifier: preg_match(/!--start_tag--(.*)!--end_tag--/s, $data, $Match) Ron Dyck wrote: I need to match text between two html comment tags. I'm using: preg_match(/!--start_tag--(.*)!--end_tag--/, $data, $Match) Which work fine until I have carriage returns. The following doesn't match: !--start_tag-- Nullam auctor pellentesque sem. Aenean semper. Aenean magna justo, rutrum et, consequat a, vehicula non, arcu. Mauris cursus vulputate pede. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.!--end_tag-- Appreciate you help. == Ron Dyck Webbtech.net == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Password generator
Hi people, I have to make a password generator, but i have a little problem. - It needs to generate password 8 characters long, and including 1 or 2 special characters(like #$%*@). - Those special characters can never appear as the first or last character in the string... anywhere between is fine. I have a password generator script now that does the first thing... but the special character can be in front or back of the string wich it shouldnt.. i have been looking on the web for this but i havent found the answer. Below is my scripts so far.. Any help is appreciated, thanks for your time, Best regards, Davy Obdam ?php // A function to generate random alphanumeric passwords in PHP // It expects to be passed a desired password length, but it // none is passed the default is set to 8 (you can change this) function generate_password($length = 8) { // This variable contains the list of allowable characters // for the password. Note that the number 0 and the letter // 'O' have been removed to avoid confusion between the two. // The same is true of 'I' and 1 $allowable_characters = abcdefghefghijklmnopqrstuvwxyz0123456789%#*; // We see how many characters are in the allowable list $ps_len = strlen($allowable_characters); // Seed the random number generator with the microtime stamp // (current UNIX timestamp, but in microseconds) mt_srand((double)microtime()*100); // Declare the password as a blank string. $pass = ; // Loop the number of times specified by $length for($i = 0; $i $length; $i++) { // Each iteration, pick a random character from the // allowable string and append it to the password. $pass .= $allowable_characters[mt_rand(0,$ps_len-1)]; } // Retun the password we've selected return $pass; } $password = generate_password(); echo $password; ? -- --- Davy Obdam Web application developer Networking4all email: [EMAIL PROTECTED] email: [EMAIL PROTECTED] internet: http://www.networking4all.com --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
At 16:19 17-6-03, you wrote: $sql = 'select * from db where apple = \'' . $_POST['foo'] . '\';'; Like that? you missed some quotes: $sql = 'select * from db where apple = \''' . $_POST['foo'] . '\''; A side question along with this ,,, how can I include $_POST['foo'] in the : $sql =select * from db where apple = '$_POST['foo']' ; or $sql = select * from db where apple = \$_POST['foo']\ ; or $sql = select * from db where apple = \{$_POST['foo']}\ ; where the {braces} help PHP to distinguish begin and end of an array within double quoted strings -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
On Tue, 2003-06-17 at 09:09, nabil wrote: A side question along with this ,,, how can I include $_POST['foo'] in the : $sql =select * from db where apple = '$_POST['foo']' ; without getting an error ?? should I append it as $var= $_POST['foo']; before??? The rule of thumb I follow with these and other Associative Arrays is: when setting the variable its $_POST['foo'] when accessing the variable its $_POST[foo] so it your example it would be: $sql = select * from db where apple = '$_POST[foo]'; -- Tom Woody In a world without boundaries why do we need Gates and Windows? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] delete files from a directory
Hi, i need to delete all the files that are stored in a dir.i had try with this and nothing happen... passthru (del $path_adjuntos.$idprod/*.* /q); i'll aprecciate your help thanks!, and excuse me for my english -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Form Elements - user adding dynamically
How would you make the input boxes open one above the other instead of one after the other? Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 4:18 PM To: Nelson Goforth Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Form Elements - user adding dynamically You can use DOM: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Strict//EN html head titleAny number you like/title script language=JavaScript1.2 function newNumber(f) { var newfile=document.createElement(input); newfile.setAttribute(type,text); newfile.setAttribute(name,number[]); f.appendChild(newfile); } /script /head body pre ?php print_r($_POST); ? /pre form action=subory.php method=post enctype=multipart/form-data input type=submit input type=button value=More onClick=newNumber(this.form); /form /body /html Nelson Goforth wrote: I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. Thanks, Nelson -- 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] Re: Difference between $_POST[foo] and $_POST['foo']?
At 16:37 17-6-03, you wrote: On Tue, 2003-06-17 at 09:09, nabil wrote: A side question along with this ,,, how can I include $_POST['foo'] in the : $sql =select * from db where apple = '$_POST['foo']' ; without getting an error ?? should I append it as $var= $_POST['foo']; before??? The rule of thumb I follow with these and other Associative Arrays is: when setting the variable its $_POST['foo'] when accessing the variable its $_POST[foo] May i rephrase that to: Use quotes whenever possible, with one exception: within double quotes. Reason: your rule of thumb fails with: $val=$_POST['val']; Plus: when using CONSTANTs as keys, do not try to access them within quoted strings. so it your example it would be: $sql = select * from db where apple = '$_POST[foo]'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
Actually I didn't. The code that I gave would result in a string like: select * from db where apple = 'blah'; For your reference: \'' means print one single quote then end the current stream. Then the . $_POST['foo'] appends the value of foo to the stream, then . '\';'; prints one more single quote to end the quote's around the value, and adds a semicolon at the end of the string to tell MySQL the query has ended. On Tue, 2003-06-17 at 10:36, Chris Hayes wrote: At 16:19 17-6-03, you wrote: $sql = 'select * from db where apple = \'' . $_POST['foo'] . '\';'; Like that? you missed some quotes: $sql = 'select * from db where apple = \''' . $_POST['foo'] . '\''; -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Difference between $_POST[foo] and $_POST['foo']?
At 16:19 17-6-03, you wrote: $sql = 'select * from db where apple = \'' . $_POST['foo'] . '\';'; Like that? you missed some quotes: $sql = 'select * from db where apple = \''' . $_POST['foo'] . '\''; Go back and count the quotes again. The original post is correct as far as quotes go. Yours is not, though, since you have three single quotes in a row and have thrown in a double quote by itself. Without color coding, this is all very hard to tell. That's why I prefer to do it such as: $sql = SELECT * FROM db WHERE apple = '{$_POST['foo']}' ; or, like someone else said, the following is perfectly valid: $sql = SELECT * FROM db WHERE apple = '$_POST[foo]' ; There are way to many methods to do this, though, so just use the one that makes the most sense to you. I've changed my mind about this a few times in the past. :) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Elements - user adding dynamically
function newNumber(f) { var newfile=document.createElement(input); newfile.setAttribute(type,text); newfile.setAttribute(name,number[]); f.appendChild(newfile); f.appendChild(document.createElement(br)); // simply add this line } You might want to take a look at some DOM tutorials, at http://www.brainjar.com/ are a few good ones. Boaz Yahav wrote: How would you make the input boxes open one above the other instead of one after the other? Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 4:18 PM To: Nelson Goforth Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Form Elements - user adding dynamically You can use DOM: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Strict//EN html head titleAny number you like/title script language=JavaScript1.2 function newNumber(f) { var newfile=document.createElement(input); newfile.setAttribute(type,text); newfile.setAttribute(name,number[]); f.appendChild(newfile); } /script /head body pre ?php print_r($_POST); ? /pre form action=subory.php method=post enctype=multipart/form-data input type=submit input type=button value=More onClick=newNumber(this.form); /form /body /html Nelson Goforth wrote: I'm constructing an HTML form (via PHP) in which I want the user to be able to add or delete elements as needed. For instance, in a page detailing user information, the user might have one phone or several. Rather than having a set number of slots for phone numbers I'd have one slot and have a button by which the user could add a slot. The user could also delete a number in a similar manner. The design goal is something like Apple's iTools web page construction tool. Beside each slot is a - and a + to delete that slot or to add another one just under the existing slot. I've got something worked out that is beginning to work, but I wondered if anyone on the list had faced a similar problem or knows of an example script that handles a problem like that. Thanks, Nelson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MSSQL connection
LS, I am trying to get a connection to a remote MSSQL server. This is what I found in the online manual : quote mssql_connect() establishes a connection to a MS SQL server. The servername argument has to be a valid servername that is defined in the 'interfaces' file. /quote This is the command given : quote $test = mssql_connect(SQL-001,whoever,whatever); /quote This is the output of the code snippet quote Fatal error: Call to undefined function: mssql_connect() in c:\program files\apache\htdocs\pestest\axtest.php on line 5 /quote The error message seems to be out of line with the manual . I was wondering whether this is related to the definition in the 'interfaces' file (whatever that may be). All help highly appreciated. Wim
Re: [PHP] Form Elements - user adding dynamically
I should have also noted DOM is not supported in old browsers or without javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MSSQL connection
You need to turn on the MSSQL extension in your php.ini, under Windows this file is probably in: c:\winnt\php.ini On Tue, 2003-06-17 at 11:01, Wim Paulussen wrote: LS, I am trying to get a connection to a remote MSSQL server. This is what I found in the online manual : quote mssql_connect() establishes a connection to a MS SQL server. The servername argument has to be a valid servername that is defined in the 'interfaces' file. /quote This is the command given : quote $test = mssql_connect(SQL-001,whoever,whatever); /quote This is the output of the code snippet quote Fatal error: Call to undefined function: mssql_connect() in c:\program files\apache\htdocs\pestest\axtest.php on line 5 /quote The error message seems to be out of line with the manual . I was wondering whether this is related to the definition in the 'interfaces' file (whatever that may be). All help highly appreciated. Wim -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] delete files from a directory
At 16:42 17-6-03, you wrote: Hi, i need to delete all the files that are stored in a dir.i had try with this and nothing happen... passthru (del $path_adjuntos.$idprod/*.* /q); 1) http://www.php.net/passthru: This function should be used in place of http://nl.php.net/manual/en/function.exec.phpexec() or http://nl.php.net/manual/en/function.system.phpsystem() when the output from the Unix command is binary data which needs to be passed directly back to the browser. Is that the case? 2) check http://nl3.php.net/manual/en/function.unlink.php, this function might be more appropriate 3) what do you see when you echo del $path_adjuntos.$idprod/*.* /q; does it look right? 4) if you use exec, try to see the error message, suggested by Carlitos on http://nl.php.net/manual/en/function.exec.php: The code looked broken but maybe you can fix it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems passing variables from Javascript to PHP
Hello =) I'm embedding an SQL query constructed in Javascript to an URL and opening it in PHP where I try to execute it. Problem is, the string arrives garbled, with all the apostrophes escaped. This must be Javascript's type of safe url encoding, but how would I go about decoding it in PHP? I thought about urldecode or rawurldecode, but Javascript doesn't seem to use RFC 1738 encoding (because of the escaped apostrophes). Then I thought about writing a Javascript function to encode the query string into RFC 1738 %-format, but then I couldn't use unicode characters in my query, right? What to do? I need to find a way so that the string can be encoded in Javascript and decoded in PHP and not get garbled. Thanks in advance, Daniel -- There are 10 kinds of people: Those who know binary and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] convert Excell to MySQL table
Hello, Does any one out there happend to know a php solution to directly (without CSV) transfer an Excell spreadsheet into MySQL table? Thanks in advance! Alex -- == Cell Phone Batteries at 30-50%+ off retail prices! http://www.pocellular.com == TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 == -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert Excell to MySQL table
If it doesn't have to be automatic, I believe you can open an ODBC connection to the MySQL database and use the export functionality of Excel. I may be wrong since it's been a while since I've done anything with Excel, but it's worth a try. On Tue, 2003-06-17 at 11:09, Alex Shi wrote: Hello, Does any one out there happend to know a php solution to directly (without CSV) transfer an Excell spreadsheet into MySQL table? Thanks in advance! Alex -- == Cell Phone Batteries at 30-50%+ off retail prices! http://www.pocellular.com == TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 == -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MSSQL connection
That's it . Thank you very much ! -Oorspronkelijk bericht- Van: Adam Voigt [mailto:[EMAIL PROTECTED] Verzonden: Tuesday, June 17, 2003 5:10 PM Aan: Wim Paulussen CC: [EMAIL PROTECTED] Onderwerp: Re: [PHP] MSSQL connection You need to turn on the MSSQL extension in your php.ini, under Windows this file is probably in: c:\winnt\php.ini On Tue, 2003-06-17 at 11:01, Wim Paulussen wrote: LS, I am trying to get a connection to a remote MSSQL server. This is what I found in the online manual : quote mssql_connect() establishes a connection to a MS SQL server. The servername argument has to be a valid servername that is defined in the 'interfaces' file. /quote This is the command given : quote $test = mssql_connect(SQL-001,whoever,whatever); /quote This is the output of the code snippet quote Fatal error: Call to undefined function: mssql_connect() in c:\program files\apache\htdocs\pestest\axtest.php on line 5 /quote The error message seems to be out of line with the manual . I was wondering whether this is related to the definition in the 'interfaces' file (whatever that may be). All help highly appreciated. Wim -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- 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] convert Excell to MySQL table
Yes I believe this is an excellent solution for MS planforms... But how about UNIX/Linux/FreeBSD based applications? Alex :[EMAIL PROTECTED] If it doesn't have to be automatic, I believe you can open an ODBC connection to the MySQL database and use the export functionality of Excel. I may be wrong since it's been a while since I've done anything with Excel, but it's worth a try. On Tue, 2003-06-17 at 11:09, Alex Shi wrote: Hello, Does any one out there happend to know a php solution to directly (without CSV) transfer an Excell spreadsheet into MySQL table? Thanks in advance! Alex -- == Cell Phone Batteries at 30-50%+ off retail prices! http://www.pocellular.com == TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 == -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic Help
On Tuesday 17 June 2003 21:22, Logan McKinley wrote: You say to RTFM, are there any good resources for new users? I know PHP.net has an extensive manual The php manual is the best resource there is, particularly for people like you who already have a background in programming. Almost all functions are explicitly explained with one or more examples. The user supplied notes in the manual are another valuable resource (download the CHM version of the manual to alleviate the strain on the bandwidth of the main php site). but a tutorial or a list of commonly used features/functions and there uses would be better for me. I need to learn about database connectivity in particular and unfortunately I must use ACCESS as my back end. There are plenty of tutorials to be found by asking google nicely. -- 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 -- /* It is easier to fight for principles than to live up to them. -- Alfred Adler */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert Excell to MySQL table
http://www.google.com/search?hl=enie=UTF-8oe=UTF-8q=php+excelbtnG=Google+Search The first link on google after doing a search for php excel looks promising. On Tue, 2003-06-17 at 11:20, Alex Shi wrote: Yes I believe this is an excellent solution for MS planforms... But how about UNIX/Linux/FreeBSD based applications? Alex :[EMAIL PROTECTED] If it doesn't have to be automatic, I believe you can open an ODBC connection to the MySQL database and use the export functionality of Excel. I may be wrong since it's been a while since I've done anything with Excel, but it's worth a try. On Tue, 2003-06-17 at 11:09, Alex Shi wrote: Hello, Does any one out there happend to know a php solution to directly (without CSV) transfer an Excell spreadsheet into MySQL table? Thanks in advance! Alex -- == Cell Phone Batteries at 30-50%+ off retail prices! http://www.pocellular.com == TrafficBuilder Network: http://www.bestadv.net/index.cfm?ref=7029 == -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] convert Excell to MySQL table
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Le Mardi 17 Juin 2003 17:19, Adam Voigt a écrit : If it doesn't have to be automatic, I believe you can open an ODBC connection to the MySQL database and use the export functionality of Excel. I may be wrong since it's been a while since I've done anything with Excel, but it's worth a try. On Tue, 2003-06-17 at 11:09, Alex Shi wrote: Hello, Does any one out there happend to know a php solution to directly (without CSV) transfer an Excell spreadsheet into MySQL table? Thanks in advance! As far as I remember, you may have some trouble with the primary keys, when exporting excel tables to MySQL through MyODBC... They seem to be recorded as normal fields, not primary key. Well, i'm not sure ;-) - -- ,, (° Nicolas Costes /|\ IUT de La Roche / Yon ( ^ ) Clé publique: http://www.keyserver.net/ ^ ^ http://www.gnu.org/philosophy/can-you-trust.fr.html -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+7zdyNc2aXy7LuOgRAt3sAJ9HqRuqUQMWWYbhiEtj9tNsEhXGXACfe7zG rdu7+/CFVLhn18e6+KWhzRc= =jg3+ -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sorting an array
Hi , I am trying to sort this: array[numrooms] = Array ( [3] = 2 [2] = 5 [1] = 1 ) I want to get a result like this: 2=5 3=2 1=1 ( I want the keys to stay attached to the results) I used this to sort it : array_multisort ($request_array['numrooms'], SORT_NUMERIC, SORT_DESC); but instead I get this: [numrooms] = Array ( [0] = 5 [1] = 2 [2] = 1 ) any suggestionis? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting an array
perhaps asort()? This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. --- Diana Castillo [EMAIL PROTECTED] wrote: Hi , I am trying to sort this: array[numrooms] = Array ( [3] = 2 [2] = 5 [1] = 1 ) I want to get a result like this: 2=5 3=2 1=1 ( I want the keys to stay attached to the results) I used this to sort it : array_multisort ($request_array['numrooms'], SORT_NUMERIC, SORT_DESC); but instead I get this: [numrooms] = Array ( [0] = 5 [1] = 2 [2] = 1 ) any suggestionis? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Mark Weinstock [EMAIL PROTECTED] *** You can't demand something as a right unless you are willing to fight to death to defend everyone else's right to the same thing. *** __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Installation
Hi, i tried installing mysql-4.1.0-alpha, apache, php4.3.2. now the issue is that i have all the 3 application running and interacting with each other in sync but every time i try to connect to mysql through php it gives me this error: Warning: mysql_connect(): Client does not support authentication protocol requested by server. Consider upgrading MySQL client this is the 1st time i am trying to set up a server i will really appreciate your helpthanks --anand -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sorting an array
array[numrooms] = Array ( [3] = 2 [2] = 5 [1] = 1 ) I want to get a result like this: 2=5 3=2 1=1 ( I want the keys to stay attached to the results) perhaps asort()? This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. Or arsort(), which will sort them in decending order. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] go through array
I have this array: Array ( [2] = 6 [1] = 2 [3] = 2 ) how do I go through it and get the key and the value in this order? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MSSQL connection
At least : step 1. Does anyone know what is meant by the 'interfaces' file ? quote The servername argument has to be a valid servername that is defined in the 'interfaces' file. /quote -Oorspronkelijk bericht- Van: Wim Paulussen [mailto:[EMAIL PROTECTED] Verzonden: Tuesday, June 17, 2003 5:14 PM Aan: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Onderwerp: RE: [PHP] MSSQL connection That's it . Thank you very much ! -Oorspronkelijk bericht- Van: Adam Voigt [mailto:[EMAIL PROTECTED] Verzonden: Tuesday, June 17, 2003 5:10 PM Aan: Wim Paulussen CC: [EMAIL PROTECTED] Onderwerp: Re: [PHP] MSSQL connection You need to turn on the MSSQL extension in your php.ini, under Windows this file is probably in: c:\winnt\php.ini On Tue, 2003-06-17 at 11:01, Wim Paulussen wrote: LS, I am trying to get a connection to a remote MSSQL server. This is what I found in the online manual : quote mssql_connect() establishes a connection to a MS SQL server. The servername argument has to be a valid servername that is defined in the 'interfaces' file. /quote This is the command given : quote $test = mssql_connect(SQL-001,whoever,whatever); /quote This is the output of the code snippet quote Fatal error: Call to undefined function: mssql_connect() in c:\program files\apache\htdocs\pestest\axtest.php on line 5 /quote The error message seems to be out of line with the manual . I was wondering whether this is related to the definition in the 'interfaces' file (whatever that may be). All help highly appreciated. Wim -- Adam Voigt ([EMAIL PROTECTED]) Linux/Unix Network Administrator The Cryptocomm Group -- 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] go through array
Hello, This is a reply to an e-mail that you wrote on Tue, 17 Jun 2003 at 17:43, lines prefixed by '' were originally written by you. I have this array: Array ( [2] = 6 [1] = 2 [3] = 2 ) how do I go through it and get the key and the value in this order? Use the foreach construct, it is documented at: http://uk2.php.net/foreach David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cron job
Is there a way to run a script (to check a table for new fields, or to check time..etc) evrey few hours, without using programes souch as crontab. Paul GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cron job
[snip] Is there a way to run a script (to check a table for new fields, or to check time..etc) evrey few hours, without using programes souch as crontab. [/snip] You could run a looping script with a sleep statement in it, not a good idea though. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cron job
Hello, This is a reply to an e-mail that you wrote on Tue, 17 Jun 2003 at 17:59, lines prefixed by '' were originally written by you. Is there a way to run a script (to check a table for new fields, or to check time..etc) evrey few hours, without using programes souch as crontab. Paul GnuPG Key http://sgi.rdscv.ro/~paulm/paulm.PGP Using a cron job is by far the best bet, if you are not allowed cron jobs on the webserver do you have access to another computer that you can run cron jobs on (you could call the PHP script using lynx from the other server). A work around is that you could have an include in each of your pages that checks the time and decides whether to do the tasks you were going to do in the cron job. This will only work if you have a busy site and if your cron job does not take long to execute though. David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cron job
Is there a way to run a script (to check a table for new fields, or to check time..etc) evrey few hours, without using programes souch as crontab. In addition to what others have said, you don't _have_ to set up the cron job (or any scheduled job) on the same computer as your scripts. If you have a Cable/DSL connection, you could set up a cron job on your own computer to connect to http://www.yourdomain.com/cron.php and run it when you need it. If you have windows, you can even do the same thing with Task Scheduler. Yeah, it makes things a little more difficult, but it's doable. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disaple warnings
Hello, I have the following code: if (file_exists(themes/$ThemeSel/modules/$name/$mod_file.php)) { $modpath = themes/$ThemeSel/;} At home on my PC (WinXP+PHP4.3.2) this code works without warnings. But in my office (Win2000+PHP4.3.0) I always becom warnings for this line and in case of any other file_exists call. (Both case the file doesn't exist) How can I disable display warning in such case? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP versioning and security information
Hi, I'm trying to figure out if the version of php that I am running is secure against all known exploits and I am finding that task very difficult. I haven't been able to find a security page on either http://www.php.net/ or http://www.zend.com/ My questions are: - is php 4.2.3 vulnerable to any known security issues? - what is the meaning of php's versioning scheme? I see from the changelogs that features are added throughout the 4.x branches. I am used to schemes where 4.2.x would be feature frozen with just bu and security fixes being applied. - is the 4.3.x branch the only one that is being maintained? I do not relish moving my servers from 4.2.3 to 4.3.? since I have encountered enough problems already with the move from 4.0.6 to 4.2.3. Most of the problems were from sloppy coding that should never have worked but hey it did work with 4.0.6 and does not work with 4.2.3. If the code were all mine I wouldn't be so concerned but I don't want to be telling clients every 6-12 months, that we're upgrading their php version and that things might break for them. Is there an official policy as to how long a branch is supported? PHP 4.2.0 is just over a year old, php 4.2.3 about 6 months old ... Thanks, -- Fraser Campbell [EMAIL PROTECTED] http://www.wehave.net/ Brampton, Ontario, Canada Debian GNU/Linux -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Naming a variable with a variable
Ho can I create (name) a variable with other variables value? If $foo = bar; then the variable I want to create is $bar. How do I do this? -antti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_errno codes
On 16-Jun-2003 Thomas Hochstetter wrote: Hi. [3rd try] ... where can i get mysql_error codes from? The ones that mysql_errno returns. You can get all the OS and MySQL error codes with: $ perror `jot 1500` | grep -v 'Unknown error' Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Naming a variable with a variable
Hi, Ho can I create (name) a variable with other variables value? If $foo = bar; then the variable I want to create is $bar. $$foo = blah; that will set $bar equal to blah. -Dan Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Naming a variable with a variable
On Tue, 17 Jun 2003, Antti wrote: Ho can I create (name) a variable with other variables value? If $foo = bar; then the variable I want to create is $bar. How do I do this? ?php $foo = 'bar'; $$foo = 'barvalue'; print $bar; ? This prints barvalue. -- Mika Tuupola http://www.appelsiini.net/~tuupola/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Naming a variable with a variable
Ho can I create (name) a variable with other variables value? If $foo = bar; then the variable I want to create is $bar. How do I do this? $$foo see: http://www.php.net/manual/en/language.variables.variable.php - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Naming a variable with a variable
$$foo or ${$foo} somethinbg like that ? http://us2.php.net/manual/en/language.variables.variable.php R'twick - Original Message - From: Antti [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 2:19 PM Subject: [PHP] Naming a variable with a variable Ho can I create (name) a variable with other variables value? If $foo = bar; then the variable I want to create is $bar. How do I do this? -antti -- 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] max_execution_time
Hi, i made a major programing mistake this mornning. It probably helped me to figure out a bug in PHP 5. But i would like to confirme with more people... class MyClass{ public MylClass(){ $this-MyFunc(); } private MyFunc(){ $this-MyFunc(); } } Avisously this loops indefinitly :) But the script never ended will i this it should have been right ? I haven't seen any bug reports for PHP5 but anybody have experienced this issu befor ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems passing variables from Javascript to PHP
On Tue, 17 Jun 2003 17:00:26 +0200, you wrote: I'm embedding an SQL query constructed in Javascript to an URL and opening it in PHP where I try to execute it. I can't believe anyone hasn't jumped on this yet :) Please be very, very careful. There's a big big hole there. Problem is, the string arrives garbled, with all the apostrophes escaped. Escaped how, exactly? With backslashes? Doubled apostrophes? The obvious thing would be a $query = str_replace('', ', $query); But again, please reconsider what you're doing - it sounds like you're trusting the client way too much. If you go ahead, ask on a database-specific mailing list about the holes you need to plug. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] go through array
-Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: 17 June 2003 17:43 I have this array: Array ( [2] = 6 [1] = 2 [3] = 2 ) how do I go through it and get the key and the value in this order? foreach ($array as $key=$value) (See www.php.net/foreach). 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] Disaple warnings
On Tue, 17 Jun 2003 19:25:39 +0200, you wrote: I have the following code: if (file_exists(themes/$ThemeSel/modules/$name/$mod_file.php)) { $modpath = themes/$ThemeSel/;} At home on my PC (WinXP+PHP4.3.2) this code works without warnings. But in my office (Win2000+PHP4.3.0) I always becom warnings for this line and in case of any other file_exists call. (Both case the file doesn't exist) How can I disable display warning in such case? Change your error reporting level http://www.php.net/manual/en/function.error-reporting.php (or set globally in php.ini) or supress the error with @ (can't find a URL, but essentially place @ in front of a statement to supress errors). However... that's just supressing the warning, not fixing it. It's odd that PHP would throw a warning if the file doesn't exist. What warning are you getting, exactly? What happens if you have a script that just contains ? if (file_exists('test.txt')) { echo(one); } else { echo(two); } ? Hmm... could this be your bug? http://bugs.php.net/bug.php?id=15932 Maybe an upgrade would fix it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bcmod()
The docs (see below) for bcmod() are rather skimpy. Does anyone have a clue as to how it works. Basically I want to do this (below code). PS: I am new to PHP but not to programming in general. Tom $i = 1; while (something true){ $modulus = the_modulus_of($i / 4); // does php do % instead of /? if($modulus == 0){ do_this_this_time(); } $i++; } *bcmod* (PHP 3, PHP 4 ) bcmod -- Get modulus of an arbitrary precision number Description string bcmod ( string left_operand, string modulus) Get the modulus of the left_operand using modulus. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bcmod()
if I read it right it looks like it returns what is the remainder as per any normal mod function so fer instance you want to get the remainder when you divide 10 by 3 (which we both know is 1) $remainder = bcmod(10,3); for example I think - Original Message - From: Thomas Bolioli [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 17, 2003 11:42 AM Subject: [PHP] bcmod() The docs (see below) for bcmod() are rather skimpy. Does anyone have a clue as to how it works. Basically I want to do this (below code). PS: I am new to PHP but not to programming in general. Tom $i = 1; while (something true){ $modulus = the_modulus_of($i / 4); // does php do % instead of /? if($modulus == 0){ do_this_this_time(); } $i++; } *bcmod* (PHP 3, PHP 4 ) bcmod -- Get modulus of an arbitrary precision number Description string bcmod ( string left_operand, string modulus) Get the modulus of the left_operand using modulus. -- 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