php-general Digest 25 Jul 2005 13:35:33 -0000 Issue 3587
php-general Digest 25 Jul 2005 13:35:33 - Issue 3587 Topics (messages 219282 through 219300): Re: how to post a question? 219282 by: Richard Lynch 219285 by: Ryan A 219297 by: Jochem Maas Re: Loading dynamic extension 219283 by: Richard Lynch Re: Don't ejecute a sentence if a field is empty 219284 by: Richard Lynch 219299 by: Jochem Maas Re: speed - PHP/MYSQL 219286 by: balwant singh function MAX with WHERE 219287 by: Jesús Alain Rodríguez Santos 219288 by: Georgi Ivanov 219289 by: Mark Rees Re: is_array() doesn't work on DOM properties? 219290 by: Jochem Maas Re: Installing OLE/Spreadsheet Excel Writer Query 219291 by: Jochem Maas running number 219292 by: Roger Thomas 219295 by: Richard Davey 219296 by: Sascha Kaufmann Closing persistent ODBC connections 219293 by: Dodot Re: Delivery Protection 219294 by: jonathan.ernst.netoxygen.ch Re: quick question about using capital letters coding w/ PHP 219298 by: Jochem Maas A strategy question about using mySQL for saving flat-file stings? 219300 by: Al Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: php-general@lists.php.net -- ---BeginMessage--- On Fri, July 22, 2005 10:11 am, Ryan A said: The str_replace calls are kinda expensive IMHO, a good regex would be better I'd be interested to see a benchmark (any benchmark) where str_replace is SLOWER than the corresponding Regex... -- Like Music? http://l-i-e.com/artists.htm ---End Message--- ---BeginMessage--- Hey Rich, The str_replace calls are kinda expensive IMHO, a good regex would be better I'd be interested to see a benchmark (any benchmark) where str_replace is SLOWER than the corresponding Regex... I am not very good with RegEx's myself, and I have never benchmarked any of them but I was told or read (when i first started learning php) that using multiple str_replace()s are not a good idea and to use a regex instead. (Thats why I wrote the IMHO,if i was wrong one of the gurus here could correct me) It kind of makes sense, for example using this from the php site: $phrase = You should eat fruits, vegetables, and fiber every day.; $healthy = array(fruits, vegetables, fiber); $yummy = array(pizza, beer, ice cream); $newphrase = str_replace($healthy, $yummy, $phrase); in the above, first it searches the entire phrase for the first parameter (fruits) then it starts again fro the second parameter (vegetables) etc, if you have a really long text it could be quite process intensivebecause it would have to go through the whole text searching for the parameters one by oneright? You're the guy who usually helps me (and a whole lot of others) when we have questions so I am really interested on your view on this, and why your view favours one side more than the other. Cheers, Ryan ---End Message--- ---BeginMessage--- Ryan A wrote: Hey Rich, The str_replace calls are kinda expensive IMHO, a good regex would be better I'd be interested to see a benchmark (any benchmark) where str_replace is SLOWER than the corresponding Regex... I am not very good with RegEx's myself, and I have never benchmarked any of them but I was told or read (when i first started learning php) that using multiple str_replace()s are not a good idea and to use a regex instead. (Thats why I wrote the IMHO,if i was wrong one of the gurus here could correct me) It kind of makes sense, for example using this from the php site: $phrase = You should eat fruits, vegetables, and fiber every day.; $healthy = array(fruits, vegetables, fiber); $yummy = array(pizza, beer, ice cream); $newphrase = str_replace($healthy, $yummy, $phrase); in the above, first it searches the entire phrase for the first parameter (fruits) then it starts again fro the second parameter (vegetables) etc, if you have a really long text it could be quite process intensivebecause it would have to go through the whole text searching for the parameters one by oneright? You're the guy who usually helps me (and a whole lot of others) when we have questions isn't he just! :-) I have to wonder how long his keyboards last ;-), or whether he retro-fits them with smoke alarms (speedtyping - overheating - fire) so I am really interested on your view on this, and why your view favours one side more than the other. regexps require a complete engine (in the same way as PHP is a engine) in order to be parsed. loading/initializing such an engine is heavier than doing a 'simple' search and replace action performance results (between str_replace() and pre_replace()) will definitely be skewed when comparing simple regexps against a comparable str_replace() because (to
Re: [PHP] function MAX with WHERE
What print_r($test_m) say ? Or echo mysql_num_rows($test); May be you get 0 records from your query. On Monday 25 July 2005 09:06, Jesús Alain Rodríguez Santos wrote: I have someting like this: $test = mysql_query(SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes = '$mes'); $test_m = mysql_fetch_array($test); $test_mes = $test_m['datos']; print $test_mes where $mes is a value I need to know if something its wrong, because I don't recive any error, but I see nothing -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que está limpio. -- Regards Georgi Ivanov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: function MAX with WHERE
Jesús Alain Rodríguez Santos [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have someting like this: $test = mysql_query(SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes = '$mes'); $test_m = mysql_fetch_array($test); $test_mes = $test_m['datos']; print $test_mes where $mes is a value I need to know if something its wrong, because I don't recive any error, but I see nothing Try this, it will tell you if something is wrong echo mysql_error(); If nothing is wrong, then perhaps your query returns no rows? Test this by removing the where clause (assuming there is some data in tabla). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_array() doesn't work on DOM properties?
John Smith wrote: I'm trying to avoid error messages while iterating over DOM properties. e.g. if(is_array($dom-stuff-props)) { maybe you can get roudn the problem by saying?: if($dom-stuff-props) { or?: if(!empty($dom-stuff-props)) { foreach($dom-stuff-props as $prop) { ... } } It works without the is_array() check, but not with my guess is you'll find that $dom-stuff-props is an object which overloads the array accessor stuff... basically it's implementing Iterator (or some other SPL Interface) hard to tell though because you don't mention which DOM related extension you are using. it. I've done var_dumps and $dom-stuff-props is indeed an array. I've also tried using an intermediate variable ($stuff=$dom-stuff) then checking that, but that doesn't work either). John Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing OLE/Spreadsheet Excel Writer Query
kevin.o'[EMAIL PROTECTED] wrote: Hi Jochem, can you telnet to pear.php.net:80 ? didn't see your reply earlier (been away from the PC). here is the answer: open a dosbox (type 'CMD' in the run dialog) then type the following in the dosbox: telnet pear.php.net 80 if you get a 'Connecting to...' flashing on your cmdline and then an empty screen then you are connecting fine. the empty screen is actually a prompt for you to type a request (an HTTP request) e.g. type the following (+ ENTER) will return the HTML for the index page of that domain: GET / HTTP/1.1 AND PLEASE NEVER ONLY POST A QUESTION DIRECT TO THE GUY/GIRL THAT IS HELPING YOU ATM THEY (i.e. me) ARE NOT YOUR PERSONAL HELPDESK... POST TO THE LIST (also gives other people to learn from your problems!) How do I do this? I have selected start run cmd telnet so far. Kevin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] running number
I am required to write a user registration script that captures the basics like name, phone number etc etc. I would also have to write to mySQL database a number that is associated with that user. At this point of writing, the start of that number is unknown. But the number will be incremented by 1 after each successfull registration. Let's say the number starts from 12345. I am quite new at all these stuff and would like to seek your advise on the *recommended way* of achieving this. I am thinking along these lines: a) store that number (12345) in a table b) a user registers and assign that number to him c) increment number to 12346 d) process repeats for the next registration Concern: How do tell mySQL to lock the 'number' table when a new registration process is about to take place. Is locking the best option here or is/are there better ways? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Closing persistent ODBC connections
Hello everyone, The php manual isn't very clear about when and how ODBC persistent connection are actually closed. I tried with odbc_close_all() but I'm not sure it really closes the connection, since the next call to odbc_pconnect() will be faster than before! The problem is that regularly I really need to close all connections to the ODBC for maintenance... And I would like to do this without shutting down apache ;) Thanks for all your advices! Jean-Francois, 22, France. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Delivery Protection
SMTP: Please confirm the attached message. +++ Attachment: No Virus found +++ MessageLabs AntiVirus - www.messagelabs.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running number
Hello Roger, Monday, July 25, 2005, 10:21:54 AM, you wrote: RT I am quite new at all these stuff and would like to seek your RT advise on the *recommended way* of achieving this. I am thinking RT along these lines: RT a) store that number (12345) in a table RT b) a user registers and assign that number to him RT c) increment number to 12346 RT d) process repeats for the next registration RT Concern: How do tell mySQL to lock the 'number' table when a RT new registration process is about to take place. Is locking the RT best option here or is/are there better ways? Do you HAVE to have a starting off number of 12345? If there is no real reason to do this, then use an auto-increment column in MySQL and let that do all the hard work for you! Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running number
try mySQL's auto increment attribute http://dev.mysql.com/doc/mysql/en/example-auto-increment.html Roger Thomas wrote: I am required to write a user registration script that captures the basics like name, phone number etc etc. I would also have to write to mySQL database a number that is associated with that user. At this point of writing, the start of that number is unknown. But the number will be incremented by 1 after each successfull registration. Let's say the number starts from 12345. I am quite new at all these stuff and would like to seek your advise on the *recommended way* of achieving this. I am thinking along these lines: a) store that number (12345) in a table b) a user registers and assign that number to him c) increment number to 12346 d) process repeats for the next registration Concern: How do tell mySQL to lock the 'number' table when a new registration process is about to take place. Is locking the best option here or is/are there better ways? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to post a question?
Ryan A wrote: Hey Rich, The str_replace calls are kinda expensive IMHO, a good regex would be better I'd be interested to see a benchmark (any benchmark) where str_replace is SLOWER than the corresponding Regex... I am not very good with RegEx's myself, and I have never benchmarked any of them but I was told or read (when i first started learning php) that using multiple str_replace()s are not a good idea and to use a regex instead. (Thats why I wrote the IMHO,if i was wrong one of the gurus here could correct me) It kind of makes sense, for example using this from the php site: $phrase = You should eat fruits, vegetables, and fiber every day.; $healthy = array(fruits, vegetables, fiber); $yummy = array(pizza, beer, ice cream); $newphrase = str_replace($healthy, $yummy, $phrase); in the above, first it searches the entire phrase for the first parameter (fruits) then it starts again fro the second parameter (vegetables) etc, if you have a really long text it could be quite process intensivebecause it would have to go through the whole text searching for the parameters one by oneright? You're the guy who usually helps me (and a whole lot of others) when we have questions isn't he just! :-) I have to wonder how long his keyboards last ;-), or whether he retro-fits them with smoke alarms (speedtyping - overheating - fire) so I am really interested on your view on this, and why your view favours one side more than the other. regexps require a complete engine (in the same way as PHP is a engine) in order to be parsed. loading/initializing such an engine is heavier than doing a 'simple' search and replace action performance results (between str_replace() and pre_replace()) will definitely be skewed when comparing simple regexps against a comparable str_replace() because (to start with) the overhead of calling a function in php (which is why its better to call str_replace() with arrays in param 1 and 2 rather than calling str_replace() multiple times) ...also sporadic CPU load due to totally unrelated processes (even when running on your local machine) can totally skew a benchmark test. I think you can trust Richard on this one! and if you don't ... :-) ... then I bet you a beer he'd say we'll then, why not test it and see! Cheers, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] quick question about using capital letters coding w/ PHP
Richard Lynch wrote: On Sun, July 24, 2005 11:39 am, Dotan Cohen said: On 7/24/05, Bruce Gilbert [EMAIL PROTECTED] wrote: I am well versed in coding with xhtml which requires all lower case and am pretty much a newbie at PHP so that is why I am asking this question. is this acceptible if ($_post [sender_email] == ) or does at have to be if ($_POST [sender_email] == ) in short, do uppercase and lowercase always have the same meaning. thx, PHP is case-sensitive. UppERCase is NOT the same as uppercase. HTML is not case sensitive only because browsers are forgiving. PHP variables are case-sensitive. PHP FUNCTIONS are not. You're on your own figuring out if class names/methods are/aren't case-sensitive this week. :-v 1. classname are case-insensitive (at least in all the builds I have running) but since 5.0.1 (IIRC) the engine honors your case when using get_class(), in the past the class name was always returned lowercase. so: php -r 'class Test {} $t = new Test; if ($t instanceof test) { echo yeah!\n; } echo get_class($t),\n;' will echo: yeah! Test 2. methodnames are the same as functionname with regard to case-sensitivity 3. constants (and class constants) are case sensitive. ...somebody beat me with a virtual stick if I am wrong! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Don't ejecute a sentence if a field is empty
Jesús Alain Rodríguez Santos wrote: Hello I'm new: I need to know how can I stop a php sentence if my db is empty, for example I have writed a php sentence, if every fields from mmy db are full, there what do you mean by 'php sentence'? is no problem, but I delete every values from the all fields in my db when I ejecute my script mysql give me an error, Ej: $fecha = mysql_query(SELECT event_day, event_month, event_year FROM $db_table WHERE event_title = $dia_maximo); $fecha_max = mysql_fetch_array($fecha); $fecha_maxima = $fecha_max['event_day']; $diames_maximo = $fecha_max['event_month']; wehen I ejecute the script the error message is it: you get this message because $fecha is not what you think it is - I am willing to bet that it actually contains FALSE), the reason it would contain false is that your SQL statement is invalid. at the very least it should read something like: SELECT event_day, event_month, event_year FROM $db_table WHERE event_title = '$dia_maximo' if the value of $dia_maximo is coing from the user then you should be sanitizing the value before using it in a query (see, as a start, http://nl3.php.net/manual/en/function.mysql-real-escape-string.php) Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/cfg/prueba/calendar_este2/index.php on line 277 sorry for my english, I'm cuban dont be! (your english is better than my spanish! this probably goes for most people onm the list!) besides for some reason I had to really laugh when I read then the word 'ejecute' ... laughing is always good! :-) btw I think you meant 'execute' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A strategy question about using mySQL for saving flat-file stings?
I've been creating a number of CM applications for a virtual-host website. One feature, of several applications, allows the editor [one of our people] to create simple text files. I've been using simple flat-files in a directory for saving the files. I've gotten tried of dealing with directory permission problems, etc., and am considering using a simple mySQL DB for storing the file strings. Obviously, for each file-string to be unique, its path must be included as part of the ID. Here is my question. I can use one table for all the path/files and use the following as the primary key /home/some-dir/filename. fields: fullpath-filename | path | type | date | binary-string path is so the code can do an equivalent of scandir() type signifies whether data has been serialized() or not. This is so I can save arrays date is the equivalent of file last mod date. Or, I can create a separate table for each full-path used and then just use the filename for the primary key. In this case, since the table name is in effect the path, only the filename is needed. The first approach is obviously simplest; but, I'm concerned about getting myself into a trap later on. Anyone offer any suggestions? Many thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A directory permissions question
I'm on virtual-host server and have been following a rule of making certain all directories on the root have permissions set to 755. This is the default when creating new directories with ftp, etc. Occasionally, I need directories with 757 and have always made certain they were not on the root. I've started thinking about whether my rule really makes any sense for security reasons. In general, the site is well protected by the host's security measures and my use of the Apache basic authorization where needed, etc. Comments and suggestions??? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A strategy question about using mySQL for saving flat-file stings?
I don't know if this is of any help, but you can make a mysql field Unique without it being an index/primary key. - Original Message - From: Al [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, July 25, 2005 9:40 AM Subject: [PHP] A strategy question about using mySQL for saving flat-file stings? I've been creating a number of CM applications for a virtual-host website. One feature, of several applications, allows the editor [one of our people] to create simple text files. I've been using simple flat-files in a directory for saving the files. I've gotten tried of dealing with directory permission problems, etc., and am considering using a simple mySQL DB for storing the file strings. Obviously, for each file-string to be unique, its path must be included as part of the ID. Here is my question. I can use one table for all the path/files and use the following as the primary key /home/some-dir/filename. fields: fullpath-filename | path | type | date | binary-string path is so the code can do an equivalent of scandir() type signifies whether data has been serialized() or not. This is so I can save arrays date is the equivalent of file last mod date. Or, I can create a separate table for each full-path used and then just use the filename for the primary key. In this case, since the table name is in effect the path, only the filename is needed. The first approach is obviously simplest; but, I'm concerned about getting myself into a trap later on. Anyone offer any suggestions? Many thanks. -- 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] Wierd time shifting problem?!?
Greetings, I have an application I built that allows the user to schedule mailings to subscribed users for specific times and dates. Everything was working fine as far as I could tell then all of a sudden this time shifting problem started popping up and seems to be getting worse. The application makes extensive use of the date() and time() command for generating and displaying dates and times. It appears that the times are shifting 7 hours into the future. If I shutdown Apache then start it back up next time I log into the application all of the times are now displayed correctly. Below is my server configuration: - Windows Advanced Server 2000 with all updates applied - Apache 2.0.47 non SSL - PHP 4.3.3 using Apache2 module - MySQL 4.0.14-max - phpMyAdmin 2.5.2-pl1 The application itself also makes heavy use of: - Adodb 4.52 - Smarty 2.6.5 I am hoping someone can at least point me in the right direction here as this is starting to become very annoying. We are going to be moving the application over to an Mac OSX 10.4 server in the near future but I still need to find out why this is happening on the Windows server. I have never had this type of thing happen on this server to my knowledge. I am going to be upgrading Apache to 2.0.54 and PHP to 4.4.0 probably today to see if this helps. I have also considered moving Apache back to the 1.3x series as I have heard that the 2.x series has some stability problems on Windows. Anyways, thank you in advance to anyone that can help me!!! Gord -- Gord Busse mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Website: http://gordo.bussefamily.net http://gordo.bussefamily.net 99 little bugs in the code, 99 bugs in the code, fix one bug, compile it again... 101 little bugs in the code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Prepopulating form fields afer an error
Hi, I have a form and it does basic error checking after submission; when the user omits required fields it kicks back the form with highlighted errors telling them the error of their ways. I've sussed out that by populating the value of the field with $fieldvalue I can have that form field populated with the data the user *did* enter for that field: something like input type=text name=email_address value=?php echo $email_address? That works great. But how can I do the same thing for drop down boxes, when they select an option? I tried the unwieldy, select name='blah' ?php if (!empty(blah)) { echo option value='; echo $blah; echo ' echo $blah; echo /option\n; } ? And that, lo and behold, didn't work. Can anyone offer a suggestion? Thanks in advance JJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to install phpize and php-config?
Hi, I'm afraid I'm not sure about how to install phpize and php-config. I used to install php using rpms, but this time I downloaded php5 from php.net and configure it with the following options: ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-soap The installation runs fine but phpize and php-config are required to install eaccelerator and now I don't know if I should add the pear module to the above line or It should be done another way. locate phpize returns: /usr/src/php-5.0.4/scripts/phpize.m4 /usr/src/php-5.0.4/scripts/phpize.in /usr/src/php-5.0.4/scripts/phpize locate php-config returns: /usr/src/php-5.0.4/scripts/php-config.in /usr/src/php-5.0.4/scripts/php-config but I don't have the executables in /usr/local/bin, as usual. What should I do? What about php from the command line? What can I do to install the usual /usr/local/bin/php? Thanks in advance, Victor.
[PHP] How would you create a tracking pixel?
I want to create a pixel that can be used to track certain activity on the site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app that does what I want it to do; but then I don't know how to actually return a blank pixel. Can anyone point me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepopulating form fields afer an error
select name=user $_REQUEST['user']==$curr_user?$select=selected:$select=; echo(option $select$curr_user/option); /select Jack Jackson wrote: Hi, I have a form and it does basic error checking after submission; when the user omits required fields it kicks back the form with highlighted errors telling them the error of their ways. I've sussed out that by populating the value of the field with $fieldvalue I can have that form field populated with the data the user *did* enter for that field: something like input type=text name=email_address value=?php echo $email_address? That works great. But how can I do the same thing for drop down boxes, when they select an option? I tried the unwieldy, select name='blah' ?php if (!empty(blah)) { echo option value='; echo $blah; echo ' echo $blah; echo /option\n; } ? And that, lo and behold, didn't work. Can anyone offer a suggestion? Thanks in advance JJ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you create a tracking pixel?
I want to create a pixel that can be used to track certain activity on the site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app that does what I want it to do; but then I don't know how to actually return a blank pixel. Can anyone point me in the right direction? Create a 1x1 blank pixel gif and then... Header(Content-type: image/gif); readfile(/path/to/spacer.gif); Why use mod_rewrite? Why not just do something like... href=/path/to/phpapp.php/spacer.gif ? -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you create a tracking pixel?
A blank (transparent) pixel would be more difficult, but a simple colored pixel would be easy: In target file: img src=pixel.php pixel.php ? $im=imagecreate(1,1); $white=imagecolorallocate($im,255,255,255); imagesetpixel($im,1,1,$white); header(content-type:image/jpg); imagejpeg($im); imagedestroy($im); ? I guess this begs the question, why not use session variables to track activity?? Matt Darby Brian Dunning wrote: I want to create a pixel that can be used to track certain activity on the site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app that does what I want it to do; but then I don't know how to actually return a blank pixel. Can anyone point me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How would you create a tracking pixel?
Thanks. A transparent pixel is what I'll need - any guidance on that? On Jul 25, 2005, at 12:37 PM, Matt Darby wrote: A blank (transparent) pixel would be more difficult, but a simple colored pixel would be easy: In target file: img src=pixel.php pixel.php ? $im=imagecreate(1,1); $white=imagecolorallocate($im,255,255,255); imagesetpixel($im,1,1,$white); header(content-type:image/jpg); imagejpeg($im); imagedestroy($im); ? I guess this begs the question, why not use session variables to track activity?? Matt Darby Brian Dunning wrote: I want to create a pixel that can be used to track certain activity on the site. I've got it working fine: I just mod_rewrite spacer.gif to a PHP app that does what I want it to do; but then I don't know how to actually return a blank pixel. Can anyone point me in the right direction? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepopulating form fields afer an error
Here's the way I do it: The following is an HTML code snippet with embedded PHP code for the intelligence. select name=shipper option value=DHL ? if ($shipped_via == DHL) echo selected; ?DHL option value=FedEx ? if ($shipped_via == FedEx) echo selected; ?FedEx option value=UPS ? if ($shipped_via == UPS) echo selected; ?UPS /select Mark Cain - Original Message - From: Jack Jackson [EMAIL PROTECTED] To: [php] PHP General List php-general@lists.php.net Sent: Monday, July 25, 2005 2:37 PM Subject: [PHP] Prepopulating form fields afer an error Hi, I have a form and it does basic error checking after submission; when the user omits required fields it kicks back the form with highlighted errors telling them the error of their ways. I've sussed out that by populating the value of the field with $fieldvalue I can have that form field populated with the data the user *did* enter for that field: something like input type=text name=email_address value=?php echo $email_address? That works great. But how can I do the same thing for drop down boxes, when they select an option? I tried the unwieldy, select name='blah' ?php if (!empty(blah)) { echo option value='; echo $blah; echo ' echo $blah; echo /option\n; } ? And that, lo and behold, didn't work. Can anyone offer a suggestion? Thanks in advance JJ -- 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] How would you create a tracking pixel?
I did some more STFW and came up with this - I'll try it to see if it works. Header( Content-type: image/gif); printf (%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c% c%c%c%c%c%c%c%c%c%c%c%c%c, 71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0 ,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59); I guess this begs the question, why not use session variables to track activity?? A tracking pixel is used in a block of code that you provide to other people to post on their sites - i.e. for a web counter, ads, etc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Full time PHP/MySQL position available
We have a great deal of PHP/MySQL web development work scheduled and as a result my employer is in need of another coder. Here is the ad on Monster: http://jobsearch.monster.com/getjob.asp?JobID=25532652 Resumes: [EMAIL PROTECTED] The job is in Nashville, TN, USA. Only local or soon to be local candidates will be considered. Thanks, -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running number
CREATE TABLE `users` ( `num` int(10) NOT NULL auto_increment, `name` varchar(100) NOT NULL default '', `login` varchar(100) NOT NULL default '', `password` varchar(20) NOT NULL default '', PRIMARY KEY (`num`), KEY `num` (`num`) ) TYPE=MyISAM AUTO_INCREMENT=12345 ; That should help out. When creating the table in mysql you can set the auto_increment number on the last line, which when you add a new user the query looks like: insert into users values('','name','login','pass'); leaving the first field empty makes it automatically increase it. The beauty is that you can have 400 people registering at once, and their number gets assigned as the query is run against the database, no matter what order they hit it in, the system will take it as they come. HTH, Robert Roger Thomas is quoted as saying on 7/25/2005 5:21 AM: I am required to write a user registration script that captures the basics like name, phone number etc etc. I would also have to write to mySQL database a number that is associated with that user. At this point of writing, the start of that number is unknown. But the number will be incremented by 1 after each successfull registration. Let's say the number starts from 12345. I am quite new at all these stuff and would like to seek your advise on the *recommended way* of achieving this. I am thinking along these lines: a) store that number (12345) in a table b) a user registers and assign that number to him c) increment number to 12346 d) process repeats for the next registration Concern: How do tell mySQL to lock the 'number' table when a new registration process is about to take place. Is locking the best option here or is/are there better ways? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 512 BrickHaven Drive Suite 220L, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Delivery reports about your e-mail
Ô]»È§¦FikËä/ÐÚZQò'É% æQç6^ÂCÛ 3é GÉÝwpÑtδÎH*BOðqŪX©¦ tº!¡Ø:I9Ó¤xsÊ6ÚOJm¼ôRɽ¸»[ÚÛaÉ^JYû¼£79Ê5¤$}NbÍ4ÊÚª{ÞX£~7 »c¢©bþ Ê|/ÃKN7áó¨-ËmBëwÚÄL°9#䩪jcÙå ôê³dÚ1Ãyæ¾ú¤âeiÒMEz?¥(DÉä2Ù].¾¦êõËʱµVÚOÏÅík'|² ùs¯°.'z¦÷$_¶)}IèÝÝ6EìEHÇz,[ØÍîSóà{ð¸AÆ]Bz¯Fá¯)¸¼Ø±mȨ~K¤YM-rÇ¥Æ\éç£öÂ\Nh#ö7ÕÝVÅçt/e3]w«f®ô sÓ`·øhXþfª¾¢Hu6DÉp`{ùèaÞÖ[k:õ÷XD¡Ô-S ªýâ)Û³Ô;ãôAÒâµÄ¶wmBËa\58EÛ ³ÚkÜlBsç!l ëzáBôGz?Sq9®åÐGªù/\â±GÃyÍýÕAãÓϵ³n¡±ýðdU÷¨^t^»(ý%ì´Dú/çð¯±Þú[u¿nZutCvô6i¿-$[èãàTöù·PSÔòªÀí*t1êfAÊ{®~º5! ØÅË^}EOíÂ]B·õéåò ¦¤8¨. µ!f AäsÓÉJK·7Jêä3iÞa ÆpméêN®KrýÙµPù9ÌJ0/èw ÅH»;ßJú¸7vEd ±«Å£WÓÈ)åª4GwNu`¨ñ¬æ¤°¾«AV¾àö;rQçºxØâ¢fòR,È!À3P¹,¥idÂ:|À4Ad½%æHF{º0ãøÖ:¾bÆ\3fÞiÉ»nmÈ9ð/aãOÍ0ü;2áƼ$/s5b, Ç u øNÂþ Ïû¬}¾µç³Ç4.»×ãSó C³Ê~B.Ãp'M×h¼Õ¾¹äïåð¦c´æ,C£Ó½h﮲sô {¬WeØg÷óèð±]s\WéXEâãab¯°°£ãôc'k~è¹÷nû$´6Û;/È oHït°t¿t8î¤3Æ1Þß7λù¤_¤ÙHå1IdN¹èýj¯:¸ÇáfòtÔÕ$¨Ê²l½7Ák)öcýð·/eJ!Ó-ÚórݵZ:Y´×ßþ¦W!ØXÛìõ×÷ϾÄëC¹VM-é)úÜj«z.!¢P1å³Sç%?Ø£Rdß hÏX?Ñ\aURjx« !`C´gÃ3Q£îBÍrzuûªÏÛ§KÊY£$J©ÆFÌùÕ·X zܧâp[òºònϳÔ#³l?#Õªà»;xçÃüí9Ïö²Ãº;!áCô¯eTù(ÑÈPc¬oã%U?H,õKJ4aÜäf9¾¥îAlRL;¥ñ¶07®¯gvÛàAäfNµÐÀÝ66yá9V×'}ë²{,båqLsýÞ tóA*nÁjÎ`9#Ñf¸ ö* *æáÅÁæYû|ý ¸Um¯'8ógǧj6 !s6½ÓîM¦O A¦:'ĹM«ò©fáe§5Ñgía¦J|¾·²5oOÛ,%n?°M:íòCÅÑäçµÄY iôk-¬VÃä4Ù²:ì)J.OæÁÇPcæÑp£ã#SG$½_µ'B»þƯթrÅ¡Fø£z·ªÄaª£úËlLªV·¡ §¿ÎãnuyI×xq[\ªA·ü4ÀmkLÚÏz_Ó4»úL¿:ð c¨wüzºéý©Cw¦¢4d¦vûùyú/¬Ö`oYOkÀ1ÄÒ»L13à k¯®ÁÔ¨Y\| À¡#2ïýk6hý*ÂÃYÏ PbdâK¤A|¦©¨Cñ æXh¨Ý¾À¹w·¸Ö#ÅÂÇkðÑJÏ÷vþuH*Új;¤\ý°Æp±çCÝ/ßG)²oíBïiN:TK×!P©¥¾09N.ôkWYn§¢eÔ çuâ#ÏÄû Z7h©h¹]×N¤$ ©ÞuÐøi]Vì4:_íß\ô̾mg¼ýxÛâýÚ¡C°g¥äãQ\e÷0Pþ¡p2ÁÅN2VOþ\IÊdøPßÜà¤áçßýüÂ]NK À¶zøPãêEý ~ÈxÓ¹xÑÐê¿ñÛõLõaR5X-ß°¤. ]1ñó Ì`¹¥Í¾Ë)öEGì{íQ¥Ö?¬$* GÛ2é±mÛaØx`rn¥`·ÅN\QÉ2´%_SG½Rl¬E2,LU§]xLFM6ÐO%5'pGl`´í5´øã ÕФ[xæÁÉ«{¥gtg»,Mîµ_ýʾWÁ¨ÁVTíMWÚà¿-P$vÅÖYËQ}h¾Ö¯Ø]ÖÆï äßÀå¡ËýB÷¹ù±ietf2;êûûc©¸~ö¾Ù¹[ñcÊVOÈK~O-U EÒíTC¯fùîímqËMeµãvFÊm¢.îjßÀwQíéæ)cæã¦X¯°x(ö|id] GÐïUhÅ×R;fª_m©dÈTjÙÛÜ[Ip¾¡Ç òGX#ßU)³xâ\ϼ Ã~^9iùFýNåHbBªÍ´ 6jhÔä~¾%ÁÃ\ÎgóZócKÕ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Prepopulating form fields afer an error
Thanks so much, Mark, Matt and John! I'll play with all those. Much appreciated, JJ Mark Cain wrote: Here's the way I do it: The following is an HTML code snippet with embedded PHP code for the intelligence. select name=shipper option value=DHL ? if ($shipped_via == DHL) echo selected; ?DHL option value=FedEx ? if ($shipped_via == FedEx) echo selected; ?FedEx option value=UPS ? if ($shipped_via == UPS) echo selected; ?UPS /select Mark Cain - Original Message - From: Jack Jackson [EMAIL PROTECTED] To: [php] PHP General List php-general@lists.php.net Sent: Monday, July 25, 2005 2:37 PM Subject: [PHP] Prepopulating form fields afer an error Hi, I have a form and it does basic error checking after submission; when the user omits required fields it kicks back the form with highlighted errors telling them the error of their ways. I've sussed out that by populating the value of the field with $fieldvalue I can have that form field populated with the data the user *did* enter for that field: something like input type=text name=email_address value=?php echo $email_address? That works great. But how can I do the same thing for drop down boxes, when they select an option? I tried the unwieldy, select name='blah' ?php if (!empty(blah)) { echo option value='; echo $blah; echo ' echo $blah; echo /option\n; } ? And that, lo and behold, didn't work. Can anyone offer a suggestion? Thanks in advance JJ -- 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] [PHP4]: Problem with Form not putting Data in Post Request
Hi, I got a slight problem with a Form that doesn't correctly transmits its data correctly under entering some special data. I put together an example to get hold of the problem but so far I do not have a clue why this doesn't work. Be great if someone got an idea. Here is the sample script I put together to see what actually gets transferred when the Form is submitted. File: ftest.php !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN html head titleForm Test Page/title META http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body form action=ftest.php method='post' encoding='text/plain' Enter a text: input name=TheText type=text size=10 maxlength=10input type=submit /form ?php import_request_variables(gPC,FORM); echo Data from last request:br; echo POST:br; print_r ($_POST); echo brGET:br; print_r ($_GET); echo brCookies:br; print_r ($_COOKIE); ? /body /html Pretty simple and straightforward. The statistics page I currently work on requires to enter a Groupname. All but one groupname so far get accepted. The one that does not get accepted is Group including the If I enter this into the form and submit the data doesnt get forwarded into the post data. Even changing the encoding did not work. I triedthat did work strange enough even alone works but as soon something is in between nothing gets into the post-data. Does anybody have an explanation? Maybe I overlooke something. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] performance.
Hi, this could be a silly question. Is there some performance penalty when using the operator like this: $var =EOP add a bunch of text here and here EOP; Just curious. Thanks, Rodolfo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP4]: Problem with Form not putting Data in Post Request
maddog1169 wrote: The one that does not get accepted is Group including the You have something like this? input type=text name=Group / It should work. Make sure you have quotes around it, of course, or weird stuff will happen. Try something like this: form action=f.php method=POST input type=text name=Group / /form ?php phpinfo() ? Type something in the form field and hit return and then scroll down and look at the $_REQUEST and $_POST variables. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] running number
Thanks to all that have helped. I am inclined at Robert's suggestion below that would free me from worrying about locking issues. Thanks everybody. -- Roger Quoting Robert Sossomon [EMAIL PROTECTED]: CREATE TABLE `users` ( `num` int(10) NOT NULL auto_increment, `name` varchar(100) NOT NULL default '', `login` varchar(100) NOT NULL default '', `password` varchar(20) NOT NULL default '', PRIMARY KEY (`num`), KEY `num` (`num`) ) TYPE=MyISAM AUTO_INCREMENT=12345 ; That should help out. When creating the table in mysql you can set the auto_increment number on the last line, which when you add a new user the query looks like: insert into users values('','name','login','pass'); leaving the first field empty makes it automatically increase it. The beauty is that you can have 400 people registering at once, and their number gets assigned as the query is run against the database, no matter what order they hit it in, the system will take it as they come. HTH, Robert Roger Thomas is quoted as saying on 7/25/2005 5:21 AM: I am required to write a user registration script that captures the basics like name, phone number etc etc. I would also have to write to mySQL database a number that is associated with that user. At this point of writing, the start of that number is unknown. But the number will be incremented by 1 after each successfull registration. Let's say the number starts from 12345. I am quite new at all these stuff and would like to seek your advise on the *recommended way* of achieving this. I am thinking along these lines: a) store that number (12345) in a table b) a user registers and assign that number to him c) increment number to 12346 d) process repeats for the next registration Concern: How do tell mySQL to lock the 'number' table when a new registration process is about to take place. Is locking the best option here or is/are there better ways? Please advise. -- Roger --- Sign Up for free Email at http://ureg.home.net.my/ --- -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 512 BrickHaven Drive Suite 220L, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Sign Up for free Email at http://ureg.home.net.my/ --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Searching and Count within array
Hi Master, I have an array as : $myArray = array('four','four','four','four','one,,'three','three','three','two','two'); Then I want output like this, //== four is 4 times three is 3 times two is 2 times one is 1 times //(it 's better if one is 1 time). //=== How can I search and count the array? Or better search and count directly using MySQL API? Note : array was generated from MySQL DB //== ?php $connection = mysql_connect(localhost,user,pass); mysql_select_db(ecd); $result = mysql_query(SELECT * FROM pre_main ORDER BY mDate DESC LIMIT 20,$connection); while ($row = mysql_fetch_row($result)) { $myArray[] = $row[0]; } sort ($myArray);//sorting array //result : $myArray = array('two','two','three','three','three','four','four','four','four','one'); ? //= Thanks in advance
Re: [PHP] Searching and Count within array
array_count_values() Bagus Nugroho wrote: Hi Master, I have an array as : $myArray = array('four','four','four','four','one,,'three','three','three','two','two'); Then I want output like this, //== four is 4 times three is 3 times two is 2 times one is 1 times //(it 's better if one is 1 time). //=== How can I search and count the array? Or better search and count directly using MySQL API? Note : array was generated from MySQL DB //== ?php $connection = mysql_connect(localhost,user,pass); mysql_select_db(ecd); $result = mysql_query(SELECT * FROM pre_main ORDER BY mDate DESC LIMIT 20,$connection); while ($row = mysql_fetch_row($result)) { $myArray[] = $row[0]; } sort ($myArray);//sorting array //result : $myArray = array('two','two','three','three','three','four','four','four','four','one'); ? //= Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php