php-general Digest 25 Feb 2009 21:58:17 -0000 Issue 5979
php-general Digest 25 Feb 2009 21:58:17 - Issue 5979 Topics (messages 288782 through 288794): Re: syntax 288782 by: Terion Miller 288783 by: Ashley Sheridan 288785 by: Rick Duval Is eAccelerator causing these memory leaks? 288784 by: jpmad4it 288786 by: Shawn McKenzie 288787 by: jpmad4it Web Development work 288788 by: Ernie Kemp 288789 by: 9el 288794 by: Ernie Kemp Spaces Not Detected from Regular Expression preg_match 288790 by: Alice Wei 288791 by: Shawn McKenzie 288792 by: Shawn McKenzie 288793 by: Shawn McKenzie Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- SELECT something FROM tbl_name - WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) = date_col; Taking that and changing it so it works for you would result in the following. $query .= WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) = `stamp`; Try that and let us know your results. */for the archives of course/* Jim Lucas Well, looking a little closer, you will need to change a little more. Try this instead. The first should work, but if it doesn't match, try the second. WHERE DATE_SUB(NOW(), INTERVAL 7 DAY) = `stamp`; or WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) = `stamp`; also, check these to links out for more information: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_convert Thanks for the suggestions Jim and everyone I will be trying them today, I realized yesterday that here I was trying to write date functions to pull records that were within 7 days which doesn't really work when the db has JUST been created and only has some fake records I added in it from the the same day..lol...now I'm wondering if I can put some in and just put in the mySQL timestamp in the stamp field myself or basically change it to reflect older records so I can test the stamp comparisons ... ---End Message--- ---BeginMessage--- On Wed, 2009-02-25 at 07:17 -0600, Terion Miller wrote: SELECT something FROM tbl_name - WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) = date_col; Taking that and changing it so it works for you would result in the following. $query .= WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) = `stamp`; Try that and let us know your results. */for the archives of course/* Jim Lucas Well, looking a little closer, you will need to change a little more. Try this instead. The first should work, but if it doesn't match, try the second. WHERE DATE_SUB(NOW(), INTERVAL 7 DAY) = `stamp`; or WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) = `stamp`; also, check these to links out for more information: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_convert Thanks for the suggestions Jim and everyone I will be trying them today, I realized yesterday that here I was trying to write date functions to pull records that were within 7 days which doesn't really work when the db has JUST been created and only has some fake records I added in it from the the same day..lol...now I'm wondering if I can put some in and just put in the mySQL timestamp in the stamp field myself or basically change it to reflect older records so I can test the stamp comparisons ... Yes you can. I tend to just use phpMyAdmin for stuff like that, as it's generally quicker to fire that up than write a script and run it! Ash www.ashleysheridan.co.uk ---End Message--- ---BeginMessage--- WHERE date = DATE_SUB(NOW(), INTERVAL 7 DAY) Works just fine for me. R On Tue, Feb 24, 2009 at 4:15 PM, Terion Miller webdev.ter...@gmail.comwrote: Need syntax help when it comes to using a timestamp. What I'm trying to say in my query WHERE clause is to select records if the timestamp on the record is in the past 7 days from NOW() $query .= WHERE stamp NOW()-7 ; I have no clue here on this the lay language is WHERE stamp is within the past 7 days how to php that? lol Thanks Terion Happy Freecycling Free the List !! www.freecycle.org Over Moderation of Freecycle List Prevents Post Timeliness. Twitter? http://twitter.com/terionmiller Facebook: a href=http://www.facebook.com/people/Terion-Miller/1542024891; title=Terion Miller's Facebook profile target=_TOPimg src= http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0
Re: [PHP] optimizing space for array of booleans
but you're trying to pass stuff to it: public function tostring() { $str = $this-binstr($this-bits[0]); for ($i=1;$i8;$i++) $str .= , . $this-binstr($this-bits[$i]); return $str; } Slap (on my face)! My stupidity... I come from a strongly typed language background and dynamically typed language often makes me less careful. Thanks, good job =). -- View this message in context: http://www.nabble.com/optimizing-space-for-array-of-booleans-tp22159131p22198832.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] syntax
SELECT something FROM tbl_name - WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) = date_col; Taking that and changing it so it works for you would result in the following. $query .= WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) = `stamp`; Try that and let us know your results. */for the archives of course/* Jim Lucas Well, looking a little closer, you will need to change a little more. Try this instead. The first should work, but if it doesn't match, try the second. WHERE DATE_SUB(NOW(), INTERVAL 7 DAY) = `stamp`; or WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) = `stamp`; also, check these to links out for more information: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_convert Thanks for the suggestions Jim and everyone I will be trying them today, I realized yesterday that here I was trying to write date functions to pull records that were within 7 days which doesn't really work when the db has JUST been created and only has some fake records I added in it from the the same day..lol...now I'm wondering if I can put some in and just put in the mySQL timestamp in the stamp field myself or basically change it to reflect older records so I can test the stamp comparisons ...
Re: [PHP] syntax
On Wed, 2009-02-25 at 07:17 -0600, Terion Miller wrote: SELECT something FROM tbl_name - WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) = date_col; Taking that and changing it so it works for you would result in the following. $query .= WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) = `stamp`; Try that and let us know your results. */for the archives of course/* Jim Lucas Well, looking a little closer, you will need to change a little more. Try this instead. The first should work, but if it doesn't match, try the second. WHERE DATE_SUB(NOW(), INTERVAL 7 DAY) = `stamp`; or WHERE CONVERT(DATE_SUB(NOW(), INTERVAL 7 DAY), DATETIME) = `stamp`; also, check these to links out for more information: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-add http://dev.mysql.com/doc/refman/5.1/en/cast-functions.html#function_convert Thanks for the suggestions Jim and everyone I will be trying them today, I realized yesterday that here I was trying to write date functions to pull records that were within 7 days which doesn't really work when the db has JUST been created and only has some fake records I added in it from the the same day..lol...now I'm wondering if I can put some in and just put in the mySQL timestamp in the stamp field myself or basically change it to reflect older records so I can test the stamp comparisons ... Yes you can. I tend to just use phpMyAdmin for stuff like that, as it's generally quicker to fire that up than write a script and run it! Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is eAccelerator causing these memory leaks?
Hi everyone, I've installed eAccelerator 0.9.5.3 for PHP (installed as an Apache module). I have noticed that when I use my TYPO3 application, I am getting memory leak errors in Apache's error log. These errors only appear after I restart Apache, and not whilst I am browsing the PHP pages. If I disable eAccelerator I do not get these memory leaks: Hi everyone, I've installed eaccelerator 0.9.5.3 for PHP (installed as an Apache module). I have noticed that when I use my TYPO3 application, I am getting memory leak errors in Apache's error log. These errors only appear after I restart Apache, and not whilst I am browsing the PHP pages: [Tue Feb 24 15:45:02 2009] [notice] SIGHUP received. Attempting to restart [Tue Feb 24 15:45:03 2009] [notice] Digest: generating secret for digest authentication ... [Tue Feb 24 15:45:03 2009] [notice] Digest: done [Tue Feb 24 15:45:04 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/ 2.2.10 OpenSSL/0.9.8i PHP/5.2.8 configured -- resuming normal operations [Tue Feb 24 15:45:24 2009] Script: '/home/apache2/htdocs/TYPO3/ index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20004E02D18 (16 bytes), script=/home/apache2/htdocs/TYPO3/index.php Last leak repeated 98 times === Total 99 memory leaks detected === [Tue Feb 24 15:45:46 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001F4D638 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php === Total 1 memory leaks detected === [Tue Feb 24 15:45:55 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/lowlevel/config/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x80533AA0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/lowlevel/config/ index.php === Total 1 memory leaks detected === [Tue Feb 24 15:45:59 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod/tools/em/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20002309A40 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod/tools/em/ index.php Last leak repeated 17 times === Total 18 memory leaks detected === [Tue Feb 24 15:45:56 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/lowlevel/dbint/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x2000205D360 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/lowlevel/ dbint/index.php Last leak repeated 10 times === Total 11 memory leaks detected === [Tue Feb 24 15:46:10 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FF98D0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php Last leak repeated 3 times === Total 4 memory leaks detected === [Tue Feb 24 15:46:35 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_db_navframe.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x8053A9B0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_db_navframe.php === Total 1 memory leaks detected === [Tue Feb 24 15:46:36 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_clickmenu.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FF4798 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_clickmenu.php Last leak repeated 1 time === Total 2 memory leaks detected === [Tue Feb 24 15:46:58 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_shortcut.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FC0D48 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_shortcut.php Last leak repeated 1 time === Total 2 memory leaks detected === [Tue Feb 24 15:46:35 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/cms/layout/db_layout.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x200020BCF38 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/cms/layout/ db_layout.php Last leak repeated 10 times === Total 11 memory leaks detected === [Tue Feb 24 15:46:45 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x200021E4970 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php Last leak repeated 7 times === Total 8 memory leaks detected === [Tue Feb 24 15:47:00 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ db_list.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FA2560 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/db_list.php === Total 1 memory leaks detected === [Tue Feb 24 16:09:36 2009] [notice] SIGHUP received. Attempting to restart [Tue Feb 24 16:09:36 2009] [notice] Digest: generating secret for digest authentication ... [Tue Feb 24 16:09:36 2009] [notice] Digest: done [Tue Feb 24 16:09:37 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/ 2.2.10 OpenSSL/0.9.8i PHP/5.2.8 configured -- resuming normal operations [Tue Feb 24 16:14:06 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/lowlevel/dbint/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x200020B30C0 (16 bytes),
Re: [PHP] syntax
WHERE date = DATE_SUB(NOW(), INTERVAL 7 DAY) Works just fine for me. R On Tue, Feb 24, 2009 at 4:15 PM, Terion Miller webdev.ter...@gmail.comwrote: Need syntax help when it comes to using a timestamp. What I'm trying to say in my query WHERE clause is to select records if the timestamp on the record is in the past 7 days from NOW() $query .= WHERE stamp NOW()-7 ; I have no clue here on this the lay language is WHERE stamp is within the past 7 days how to php that? lol Thanks Terion Happy Freecycling Free the List !! www.freecycle.org Over Moderation of Freecycle List Prevents Post Timeliness. Twitter? http://twitter.com/terionmiller Facebook: a href=http://www.facebook.com/people/Terion-Miller/1542024891; title=Terion Miller's Facebook profile target=_TOPimg src= http://badge.facebook.com/badge/1542024891.237.919247960.png; border=0 alt=Terion Miller's Facebook profile/a Vince Lombardi - Winning is habit. Unfortunately, so is losing. -- This message has been scanned for viruses and dangerous content by Accurate Anti-Spam Technologies and is believed to be clean. i...@accurateantispam.com
Re: [PHP] Is eAccelerator causing these memory leaks?
jpmad4it wrote: Hi everyone, I've installed eAccelerator 0.9.5.3 for PHP (installed as an Apache module). I have noticed that when I use my TYPO3 application, I am getting memory leak errors in Apache's error log. These errors only appear after I restart Apache, and not whilst I am browsing the PHP pages. If I disable eAccelerator I do not get these memory leaks: Hi everyone, I've installed eaccelerator 0.9.5.3 for PHP (installed as an Apache module). I have noticed that when I use my TYPO3 application, I am getting memory leak errors in Apache's error log. These errors only appear after I restart Apache, and not whilst I am browsing the PHP pages: [Tue Feb 24 15:45:02 2009] [notice] SIGHUP received. Attempting to restart [Tue Feb 24 15:45:03 2009] [notice] Digest: generating secret for digest authentication ... [Tue Feb 24 15:45:03 2009] [notice] Digest: done [Tue Feb 24 15:45:04 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/ 2.2.10 OpenSSL/0.9.8i PHP/5.2.8 configured -- resuming normal operations [Tue Feb 24 15:45:24 2009] Script: '/home/apache2/htdocs/TYPO3/ index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20004E02D18 (16 bytes), script=/home/apache2/htdocs/TYPO3/index.php Last leak repeated 98 times === Total 99 memory leaks detected === [Tue Feb 24 15:45:46 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001F4D638 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php === Total 1 memory leaks detected === [Tue Feb 24 15:45:55 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/lowlevel/config/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x80533AA0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/lowlevel/config/ index.php === Total 1 memory leaks detected === [Tue Feb 24 15:45:59 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod/tools/em/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20002309A40 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod/tools/em/ index.php Last leak repeated 17 times === Total 18 memory leaks detected === [Tue Feb 24 15:45:56 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/lowlevel/dbint/index.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x2000205D360 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/lowlevel/ dbint/index.php Last leak repeated 10 times === Total 11 memory leaks detected === [Tue Feb 24 15:46:10 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FF98D0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php Last leak repeated 3 times === Total 4 memory leaks detected === [Tue Feb 24 15:46:35 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_db_navframe.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x8053A9B0 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_db_navframe.php === Total 1 memory leaks detected === [Tue Feb 24 15:46:36 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_clickmenu.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FF4798 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_clickmenu.php Last leak repeated 1 time === Total 2 memory leaks detected === [Tue Feb 24 15:46:58 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ alt_shortcut.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FC0D48 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/alt_shortcut.php Last leak repeated 1 time === Total 2 memory leaks detected === [Tue Feb 24 15:46:35 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ sysext/cms/layout/db_layout.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x200020BCF38 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/sysext/cms/layout/ db_layout.php Last leak repeated 10 times === Total 11 memory leaks detected === [Tue Feb 24 15:46:45 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ mod.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x200021E4970 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/mod.php Last leak repeated 7 times === Total 8 memory leaks detected === [Tue Feb 24 15:47:00 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/ db_list.php' /home/eaccelerator-0.9.5.3/optimize.c(452) : Freeing 0x20001FA2560 (16 bytes), script=/home/apache2/htdocs/TYPO3/typo3/db_list.php === Total 1 memory leaks detected === [Tue Feb 24 16:09:36 2009] [notice] SIGHUP received. Attempting to restart [Tue Feb 24 16:09:36 2009] [notice] Digest: generating secret for digest authentication ... [Tue Feb 24 16:09:36 2009] [notice] Digest: done [Tue Feb 24 16:09:37 2009] [notice] Apache/2.2.10 (Unix) mod_ssl/ 2.2.10 OpenSSL/0.9.8i PHP/5.2.8 configured -- resuming normal operations [Tue Feb 24 16:14:06 2009] Script: '/home/apache2/htdocs/TYPO3/typo3/
Re: [PHP] Is eAccelerator causing these memory leaks?
Thanks Shawn. I tried that but the log just reports the following, which I guess is usual: EACCELERATOR hit: /path/to/script.php EACCELERATOR cached: /path/to/script.php There are no mention of memory leaks, or anything else. Anyone got any other suggestions? -- View this message in context: http://www.nabble.com/Is-eAccelerator-causing-these-memory-leaks--tp22203445p22205819.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Web Development work
I really need your insight. I'm a software developer who is wishing to do Web Development. I love to program and I'm learning more about Web Design but my main skills are in programming. How do you get work as a Web Developer? One could apply for a web developer job at a Web company but I wish to be on my own. How are the freelancer finding work and where? I have had my head buried in code too long to know where to find my new cheese. Any help would be appreciation. Thanks, Ernie Kemp ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill
Re: [PHP] Web Development work
I guess you are interested about php. the freelancers work at www.scriptlance.com www.elance.com www.odesk.com www.joomlalancer.com www.getacoder.com www.getafreelancer.com and many more. I am a Web Developer at https://www.scriptlance.com/cgi-bin/freelancers/feedback.cgi?p=lenin9el with this id To be a web developer you dont need to be design oriented. You can stick to programming skills as well. Regards Lenin --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Feb 25, 2009 at 11:16 PM, Ernie Kemp ernie.k...@sympatico.cawrote: I really need your insight. I’m a software developer who is wishing to do Web Development. I love to program and I’m learning more about Web Design but my main skills are in programming. How do you get work as a Web Developer? One could apply for a web developer job at a Web company but I wish to be on my own. How are the freelancer finding work and where? I have had my head buried in code too long to know where to find my new cheese. Any help would be appreciation. Thanks, Ernie Kemp ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill* *
[PHP] Spaces Not Detected from Regular Expression preg_match
Hi, I have a code as in the following: ?php $file = test.txt; $fp = fopen($file, r); while(!feof($fp)) { $data = fgets($fp, 1024); if ((preg_match(/0/,$data)) || (preg_match(/\\s\/,$data)) || (preg_match(/\\s\/,$data))) { //Don't do a thing } } fclose($fp); ? This is the input file: 1 23kd 3dkd2 4 5 6 For the output, I get nothing running it from the command prompt, but I would like to have in the output, could anyone please give me some guides on what I have done wrong in my regular expression? Thanks for your help. Alice _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview
[PHP] Re: Spaces Not Detected from Regular Expression preg_match
Alice Wei wrote: Hi, I have a code as in the following: ?php $file = test.txt; $fp = fopen($file, r); while(!feof($fp)) { $data = fgets($fp, 1024); if ((preg_match(/0/,$data)) || (preg_match(/\\s\/,$data)) || (preg_match(/\\s\/,$data))) { //Don't do a thing } } fclose($fp); ? This is the input file: 1 23kd 3dkd2 4 5 6 For the output, I get nothing running it from the command prompt, but I would like to have in the output, could anyone please give me some guides on what I have done wrong in my regular expression? Thanks for your help. Alice _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview Ummm... #1 you haven't output anything in your code. Your code says, if is found in $data, then Don't do a thing. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Spaces Not Detected from Regular Expression preg_match
Shawn McKenzie wrote: Alice Wei wrote: Hi, I have a code as in the following: ?php $file = test.txt; $fp = fopen($file, r); while(!feof($fp)) { $data = fgets($fp, 1024); if ((preg_match(/0/,$data)) || (preg_match(/\\s\/,$data)) || (preg_match(/\\s\/,$data))) { //Don't do a thing } } fclose($fp); ? This is the input file: 1 23kd 3dkd2 4 5 6 For the output, I get nothing running it from the command prompt, but I would like to have in the output, could anyone please give me some guides on what I have done wrong in my regular expression? Thanks for your help. Alice _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview Ummm... #1 you haven't output anything in your code. Your code says, if is found in $data, then Don't do a thing. So if your wanting to see if there is a match in the line and return the match (which in this example seems pointless because you know that you are matching ), then something like this: if (preg_match(/0/,$data, $matches) || preg_match(/\\s\/,$data, $matches)) { print_r($matches); } BTW, the second and third conditions in your if appeared to be the same, also \s matches whitespace, spaces, tabs, returns, etc... -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Spaces Not Detected from Regular Expression preg_match
Shawn McKenzie wrote: Shawn McKenzie wrote: Alice Wei wrote: Hi, I have a code as in the following: ?php $file = test.txt; $fp = fopen($file, r); while(!feof($fp)) { $data = fgets($fp, 1024); if ((preg_match(/0/,$data)) || (preg_match(/\\s\/,$data)) || (preg_match(/\\s\/,$data))) { //Don't do a thing } } fclose($fp); ? This is the input file: 1 23kd 3dkd2 4 5 6 For the output, I get nothing running it from the command prompt, but I would like to have in the output, could anyone please give me some guides on what I have done wrong in my regular expression? Thanks for your help. Alice _ Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today! http://get.live.com/toolbar/overview Ummm... #1 you haven't output anything in your code. Your code says, if is found in $data, then Don't do a thing. So if your wanting to see if there is a match in the line and return the match (which in this example seems pointless because you know that you are matching ), then something like this: if (preg_match(/0/,$data, $matches) || preg_match(/\\s\/,$data, $matches)) { print_r($matches); } BTW, the second and third conditions in your if appeared to be the same, also \s matches whitespace, spaces, tabs, returns, etc... I'll wait for a reply with more information as the more I look at your code it seems your off on a strange track. I don't know the variability of your input data, but if you had a line 0 then the first preg_match would match the 0 and not the . Maybe that's what you want, dunno... -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Web Development work
Thanks for the info. It seems to me that there must to other places a freelance Web Developer fines work. How do you find work in PHP Web programming? Work a company, through this site and from God. I wish to know more than handing out a business card. Thanks in advance. ./Ernie -Original Message- From: doctortomor...@gmail.com [mailto:doctortomor...@gmail.com] On Behalf Of 9el Sent: February-25-09 12:23 PM To: Ernie Kemp Cc: php-general@lists.php.net Subject: Re: [PHP] Web Development work I guess you are interested about php. the freelancers work at www.scriptlance.com www.elance.com www.odesk.com www.joomlalancer.com www.getacoder.com www.getafreelancer.com and many more. I am a Web Developer at https://www.scriptlance.com/cgi-bin/freelancers/feedback.cgi?p=lenin9el with this id To be a web developer you dont need to be design oriented. You can stick to programming skills as well. Regards Lenin --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- On Wed, Feb 25, 2009 at 11:16 PM, Ernie Kemp ernie.k...@sympatico.cawrote: I really need your insight. I'm a software developer who is wishing to do Web Development. I love to program and I'm learning more about Web Design but my main skills are in programming. How do you get work as a Web Developer? One could apply for a web developer job at a Web company but I wish to be on my own. How are the freelancer finding work and where? I have had my head buried in code too long to know where to find my new cheese. Any help would be appreciation. Thanks, Ernie Kemp ...man will occasionally stumble over the truth, but usually manages to pick himself up, walk over or around it, and carry on. Winston S. Churchill* * No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.3/1971 - Release Date: 02/25/09 06:40:00 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] non-auto increment question
I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN= $row[id]+1; } $idIN= $_POST[idIN]; $titleIN= $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: non-auto increment question
Not sure that this is the problem BUT you should probably qualify the name of the variable such that SELECT MAX(id) AS id FROM book. But you don't want max(id) as id but rather max(id) + 1 as id. With that you can then just return the final value. Also, if you don't want to alias the value (or whatever it's called) you should use $row[0] to get it by ordinal posistion. As for now wanting to use autoincrement, you can run into a race condition where two people are inserting at the same time, thus having the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN= $row[id]+1; } $idIN= $_POST[idIN]; $titleIN= $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.ptahhotep.com/ http://www.chiccantine.com http://www.chiccantine.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=g...@primeexalia.com
Re: [PHP] RE: non-auto increment question
On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote: Not sure that this is the problem BUT you should probably qualify the name of the variable such that SELECT MAX(id) AS id FROM book. But you don't want max(id) as id but rather max(id) + 1 as id. With that you can then just return the final value. Also, if you don't want to alias the value (or whatever it's called) you should use $row[0] to get it by ordinal posistion. As for now wanting to use autoincrement, you can run into a race condition where two people are inserting at the same time, thus having the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN= $row[id]+1; } $idIN= $_POST[idIN]; $titleIN= $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.ptahhotep.com/ http://www.chiccantine.com http://www.chiccantine.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=g...@primeexalia.com Yeah, this sort of situation is really what auto increment is for. If you get two people visiting the page with this code on at the same time then you'll screw up your database. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can't set expect.timeout
Hi, Apparently I can't set the value for expect.timeout to any values other than 0 (the default is 10). Can someone try the following script and see if you see the same problem as me? My php is 5.1.6, php-expect is 0.2.4, the platform is a Redhat Enterprise Linux 5.3 Test method: 1. Drop the following script onto your php server machine (use a different ini_set() line in each successive test). 2. Use a browser to execute the script and see what phpinfo() would return the value for expect.timeout (and expect.logfile) ?php // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 1); // No effect // ini_set(expect.timeout, 5); // No effect // ini_set(expect.timeout, 5); // No effect ini_set(expect.timeout, 50); // No effect ini_set(expect.logfile, /tmp/tmp); // This worked phpinfo(); ? Thanks! Clement -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't set expect.timeout
On Wed, 2009-02-25 at 18:08 -0500, Clement Yui-Wah Lee wrote: Hi, Apparently I can't set the value for expect.timeout to any values other than 0 (the default is 10). Can someone try the following script and see if you see the same problem as me? My php is 5.1.6, php-expect is 0.2.4, the platform is a Redhat Enterprise Linux 5.3 Test method: 1. Drop the following script onto your php server machine (use a different ini_set() line in each successive test). 2. Use a browser to execute the script and see what phpinfo() would return the value for expect.timeout (and expect.logfile) ?php // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 1); // No effect // ini_set(expect.timeout, 5); // No effect // ini_set(expect.timeout, 5); // No effect ini_set(expect.timeout, 50); // No effect ini_set(expect.logfile, /tmp/tmp); // This worked phpinfo(); ? Thanks! Clement Do you have permissions to change this ini setting? Some hosting companies disallow certain variables to be set through ini_set and only allow them to be done via .htaccess, and some go even further by disallowing certain ones to be changed at all. Have you tried it on a different hosting (i.e. on your local machine) ? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can't set expect.timeout
Ash, Thanks for your answer. I am quite sure that I do have the needed permission to effect the change. As you can tell from my test script, I was able to set timeout to 0 (zero), and I could also set logfile to /tmp/tmp. I just could not set timeout to any values other than 0 or the default value of 10. I was testing on a local machine. Thanks! Clement Ashley Sheridan wrote: On Wed, 2009-02-25 at 18:08 -0500, Clement Yui-Wah Lee wrote: Hi, Apparently I can't set the value for expect.timeout to any values other than 0 (the default is 10). Can someone try the following script and see if you see the same problem as me? My php is 5.1.6, php-expect is 0.2.4, the platform is a Redhat Enterprise Linux 5.3 Test method: 1. Drop the following script onto your php server machine (use a different ini_set() line in each successive test). 2. Use a browser to execute the script and see what phpinfo() would return the value for expect.timeout (and expect.logfile) ?php // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 0); // This worked // ini_set(expect.timeout, 1); // No effect // ini_set(expect.timeout, 5); // No effect // ini_set(expect.timeout, 5); // No effect ini_set(expect.timeout, 50); // No effect ini_set(expect.logfile, /tmp/tmp); // This worked phpinfo(); ? Thanks! Clement Do you have permissions to change this ini setting? Some hosting companies disallow certain variables to be set through ini_set and only allow them to be done via .htaccess, and some go even further by disallowing certain ones to be changed at all. Have you tried it on a different hosting (i.e. on your local machine) ? Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
On Wed, 2009-02-25 at 19:03 -0500, PJ wrote: Ashley Sheridan wrote: On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote: Not sure that this is the problem BUT you should probably qualify the name of the variable such that SELECT MAX(id) AS id FROM book. But you don't want max(id) as id but rather max(id) + 1 as id. With that you can then just return the final value. Also, if you don't want to alias the value (or whatever it's called) you should use $row[0] to get it by ordinal posistion. As for now wanting to use autoincrement, you can run into a race condition where two people are inserting at the same time, thus having the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN = $row[id]+1; Actually, I am wondering how to get rid of some of the code here as it seems a little bloated How do I get rid of the row counting - since there can never be more than one row returned with this query. } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.ptahhotep.com/ http://www.chiccantine.com http://www.chiccantine.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=g...@primeexalia.com Yeah, this sort of situation is really what auto increment is for. If you get two people visiting the page with this code on at the same time then you'll screw up your database. Ash www.ashleysheridan.co.uk Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS The auto increment value is automatically inserted by MySQL, just don't specify what to put into that field when executing the sql statement in PHP. You can have PHP return the value that was just inserted using the auto_insert_id() function, which allows you to use it for other things, like inserting into other tables for a relational database structure. Also, depending on how the page is called, you could end up with one user inserting the same value into the database. if the page is called via get (i.e. a link on a page rather than as the result of a form) then some browsers will actually (in an attempt to make things faster) call the page more than once. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
Ashley Sheridan wrote: On Wed, 2009-02-25 at 14:10 -0800, Gary W. Smith wrote: Not sure that this is the problem BUT you should probably qualify the name of the variable such that SELECT MAX(id) AS id FROM book. But you don't want max(id) as id but rather max(id) + 1 as id. With that you can then just return the final value. Also, if you don't want to alias the value (or whatever it's called) you should use $row[0] to get it by ordinal posistion. As for now wanting to use autoincrement, you can run into a race condition where two people are inserting at the same time, thus having the same generated id. Hope that helps. From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN = $row[id]+1; Actually, I am wondering how to get rid of some of the code here as it seems a little bloated How do I get rid of the row counting - since there can never be more than one row returned with this query. } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.ptahhotep.com/ http://www.chiccantine.com http://www.chiccantine.com/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=g...@primeexalia.com Yeah, this sort of situation is really what auto increment is for. If you get two people visiting the page with this code on at the same time then you'll screw up your database. Ash www.ashleysheridan.co.uk Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS [JS] Are you looking for something like LAST_INSERT_ID()? If you INSERT a record that has an auto-increment field, you can retrieve the value that got inserted with SELECT LAST_INSERT_ID(). It is connection-specific, so you'll always have your own value. You can then save it to reuse, either as a session variable or (more easily) as a hidden field on your form. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: non-auto increment question
Being rather new to all this, I understood from the MySql manual that the auto_increment is to b e used immediately after an insertion not intermittently. My application is for administrators (the site owner designates) to update the database from and administration directory, accessed by user/password login... so there's really very little possibility of 2 people accessing at the same time. [JS] Being rather old to all this, I can tell you that if something is even remotely possible it will happen just before your performance review. Never depend upon this. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com By using MAX + 1 I keep the id number in the $idIn and can reuse it in other INSERTS -- Phil Jourdan --- p...@ptahhotep.com http://www.ptahhotep.com http://www.chiccantine.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=jschwa...@the- infoshop.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Development work
Hello -- - Ernie -- -- - Consulting work is a business. Work doesn't fall from the sky. You have to figure out what you do. Not good enough to say I'm a programmer -- that and a dollar will get you half-a-cup of coffee at McDonalds. Figure out where your strengths are. Figure out where you have or can cultivate contacts. Spread the word. If you don't have a demonstrable portfolio of projects from your employer or clients that you can show or discuss with others, you had better develop one. Do you have an industry that you know more about than the average developer? Do you have graphics skills, too? Do you understand how a business works? Every unemployed programmer calls himself a Web Developer. Every unemployed graphic designer calls himself a Web Designer. People who have been doing one or both for *years* call themselves the same thing. Most potential customers have no clue who is good or bad. Can you do the design work, or just the programming work. This isn't a place to get work; (based on the nature of your questions) there are 100s of folks here with more experience and savvy than you, and I bet every one of the independents have room for more clients. I have been in this business for 20 years. If you are flailing around asking naive questions like this, you probably are better off with a job. Maybe 10 years ago, someone with mid-level skills and no business acumen could be a successful web developer just because the industry was growing so fast and there were so few people with real skills. Now the situation is the opposite: there are lots and lots of people with skills. There are still jobs around, but you have to work harder to get them. If you want to be in business, you need to think like a business person (who just happens to have a technical set of skills). Good luck, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Development work
Very wise words or wisdom Ken. And Ernie, I just gave you most of the renowned places where freelancers or even large companies bid for works. There are programmers like you and as Ken said, even thousand times better programmers than you who are going along the way. Its a wonder how you do not know those names. You just gotta be friends with the google. A software engineer doesnt mean that he is god. And web developer doesnt mean unemployed. I and my team is member with lot other freelancing sites and have local and overseas permanent clients for whom we working remotely. Starting from making a blog to making crawler or video upload/download site. Or, real-estate sales, rental with Map API integrated search results. Or, say Facebook applications or iPhone apps! We just need to learn fast the best of the technologies with the best of the methods and yet we have to be business oriented. Thanks Lenin www.twitter.com/nine_L --- Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get a Free CD of Ubuntu mailed to your door without any cost. Visit : www.ubuntu.com -- 2009/2/26 phphelp -- kbk phph...@comcast.net Hello -- - Ernie -- -- - Consulting work is a business. Work doesn't fall from the sky. You have to figure out what you do. Not good enough to say I'm a programmer -- that and a dollar will get you half-a-cup of coffee at McDonalds. Figure out where your strengths are. Figure out where you have or can cultivate contacts. Spread the word. If you don't have a demonstrable portfolio of projects from your employer or clients that you can show or discuss with others, you had better develop one. Do you have an industry that you know more about than the average developer? Do you have graphics skills, too? Do you understand how a business works? Every unemployed programmer calls himself a Web Developer. Every unemployed graphic designer calls himself a Web Designer. People who have been doing one or both for *years* call themselves the same thing. Most potential customers have no clue who is good or bad. Can you do the design work, or just the programming work. This isn't a place to get work; (based on the nature of your questions) there are 100s of folks here with more experience and savvy than you, and I bet every one of the independents have room for more clients. I have been in this business for 20 years. If you are flailing around asking naive questions like this, you probably are better off with a job. Maybe 10 years ago, someone with mid-level skills and no business acumen could be a successful web developer just because the industry was growing so fast and there were so few people with real skills. Now the situation is the opposite: there are lots and lots of people with skills. There are still jobs around, but you have to work harder to get them. If you want to be in business, you need to think like a business person (who just happens to have a technical set of skills). Good luck, Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
PJ wrote: From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN = $row[id]+1; Actually, I am wondering how to get rid of some of the code here as it seems a little bloated How do I get rid of the row counting - since there can never be more than one row returned with this query. Ok, so, you want to know how to do this your way with a little less code? Give this a try: ?php $id = null; if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id)+1 AS id FROM book LIMIT 1; if ( ( $result = mysql_query($sql, $db) ) !== false ) { while ( $row = mysql_fetch_row($result) ) { list($id) = $row; } } } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ? td colspan=2 input type='text' name='id' value='?php echo $id; ?' disabled=disabled size='2' / /td } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? Ok, so, I am confused. You are asking about and $id variable, yet you show us code that attempts to insert the $idIN variable into a hidden field for the $titleIN variable. Did you cut/paste the wrong segment of code or is this what you are actually trying to use? if it is the latter, then that explains why your above example is not working like you would expect... Anyways, you will note that in the above example I corrected the variable/name mismatch. If I have it wrong sorry. /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: non-auto increment question
Jim Lucas wrote: PJ wrote: From: PJ [mailto:af.gour...@videotron.ca] Sent: Wed 2/25/2009 2:01 PM To: MySql; php-general@lists.php.net Subject: non-auto increment question I want to insert a new table entry 1 number higher than the highest in the field (id). I cannot use auto-increment. And I want to show the value of the field to be added in an input field on the web page: if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id) FROM book; $result = mysql_query($sql, $db); $bookCount = mysql_num_rows($result); for ($i=0; $i $bookCount; $i++) { $row = mysql_fetch_array($result); $idIN = $row[id]+1; Actually, I am wondering how to get rid of some of the code here as it seems a little bloated How do I get rid of the row counting - since there can never be more than one row returned with this query. Ok, so, you want to know how to do this your way with a little less code? Give this a try: ?php $id = null; if (isset($_REQUEST[AddNewBooksRequest])) { $SQL = SELECT MAX(id)+1 AS id FROM book LIMIT 1; if ( ( $result = mysql_query($sql, $db) ) !== false ) { Note: the above will not work either. You need to watch the case on your variable names. You define $SQL = '' but then use $sql... That won't work, you need to have them the same case! while ( $row = mysql_fetch_row($result) ) { list($id) = $row; } } } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ? td colspan=2 inputtype='text' name='id' value='?php echo $id; ?' disabled=disabled size='2' / /td } $idIN = $_POST[idIN]; $titleIN = $_POST[titleIN]; ...snip... td colspan=2 ? echo input type='text' name='titleIN' value='$idIN' disabled size='2'; ? Ok, so, I am confused. You are asking about and $id variable, yet you show us code that attempts to insert the $idIN variable into a hidden field for the $titleIN variable. Did you cut/paste the wrong segment of code or is this what you are actually trying to use? if it is the latter, then that explains why your above example is not working like you would expect... Anyways, you will note that in the above example I corrected the variable/name mismatch. If I have it wrong sorry. /td What am I doing wrong? (The query works and returns the right nr. but what do I have to do to add 1 to that number and then display it in the on page and post it to the table? -- -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php