Re: [PHP-DB] Database question
A really good starting-level textbook is Fabian Pascal's Practical issues in database management. My warm recommendation. It will give you a decent theoretical understanding as well as helping you designing your DB in order to avoid the most usual design mistakes. You will find there VERY important design stuff that you won't find in web tutorials. Ignatius Reilly - Original Message - From: Shiloh Madsen To: [EMAIL PROTECTED] Sent: Wednesday, August 21, 2002 1:34 AM Subject: [PHP-DB] Database question I was wondering if there were any good documents out there about good database design...I know the basics of creating tables, setting data types and such, and now i want to know how to use it to the best effect...generating logical, streamlined tables, etc. As a side-related note, i have a few tables now that call for some data which could be quite lengthly, say 3-6 paragraphs worth of text. what would be the best data style and length for this kind of field?
[PHP-DB] date comparison
hello, in my script i want to compare input date with date stored in database and want the result for date = input date and sometime for date = input date. it didn't work for = and = operators. i also tried using between but it didn't give desire result :-( is there any other comparison operator to be used for date??? thnx and regards, smita. _ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] time slots and PHP/MySQL
this is a big question and i'm not trying to get you to do my modelling for me, but if anyone has experience with this i'd appreciate being pointed in the right direction: How could one efficiently manage time slots in a dB? I mean for example telling the dB that Mike can be somewhere at 6:15 or 6:30 but not 6:45, and that Cynthia can be there at 6:15 or 7:00... ...and so on my instinct is to create a timeslots table, but it looks like it would contain 35,040 records (one for each 15-minute period in the year). egad! The alternative is to create timeslots a month at a time or something, but the table would have to be reformulated every month. any thoughts? feel free to get philosophical about it. -M -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: time slots and PHP/MySQL
Matthew, you may want to investigate MRBS (Meeting Room Booking System). it handles such things for resource allocation. i dont know where the project location is, but google is your friend Matthew Crouch [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... this is a big question and i'm not trying to get you to do my modelling for me, but if anyone has experience with this i'd appreciate being pointed in the right direction: How could one efficiently manage time slots in a dB? I mean for example telling the dB that Mike can be somewhere at 6:15 or 6:30 but not 6:45, and that Cynthia can be there at 6:15 or 7:00... ...and so on my instinct is to create a timeslots table, but it looks like it would contain 35,040 records (one for each 15-minute period in the year). egad! The alternative is to create timeslots a month at a time or something, but the table would have to be reformulated every month. any thoughts? feel free to get philosophical about it. -M -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Are running sessions using a MySQL handler faster?
Good afternoon! Quick performance question - I'm currently preparing the release of a new website running on a Linux box written in PHP and MySQL with sessions throughout. I've read a bit about changing the PHP session handler to use a database vs. the flat file method. Does anyone have experience doing this? Are there noticeable benefits of making this change? I realize that my /tmp folder will become quite cluttered with session files, but hey - it's tmp so who cares! :) My concern comes in with overall performance of the server - if one method is better than the other. Thanks for your feedback! JT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] date comparison
On Wednesday 21 August 2002 21:28, Smita Manohar wrote: hello, in my script i want to compare input date with date stored in database and want the result for date = input date and sometime for date = input date. How is the date stored? What type of field? it didn't work for = and = operators. i also tried using between but it didn't give desire result :-( How are you doing your comparison? As php code? As sql query? is there any other comparison operator to be used for date??? , =, , = can all be used if your data is in the correct format. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Oh, yeah, life goes on, long after the thrill of livin' is gone. -- John Cougar, Jack and Diane */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Are running sessions using a MySQL handler faster?
Chances are the files-based one is probably a bit quicker. Especially on systems where /tmp is optimized or perhaps even set up as a ramdisk. -Rasmus On Wed, 21 Aug 2002, Jonathan Thomas wrote: Good afternoon! Quick performance question - I'm currently preparing the release of a new website running on a Linux box written in PHP and MySQL with sessions throughout. I've read a bit about changing the PHP session handler to use a database vs. the flat file method. Does anyone have experience doing this? Are there noticeable benefits of making this change? I realize that my /tmp folder will become quite cluttered with session files, but hey - it's tmp so who cares! :) My concern comes in with overall performance of the server - if one method is better than the other. Thanks for your feedback! JT -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] time slots and PHP/MySQL
Don't want to get too philosophical, but don't PIM/Contact Management projects like TWIG have a feature like this? Now, this is just off the top of my head, but rather than create a timeslots table, wouldn't you have an event table, and a member_booked table? The minimum fields in event would be event_id(primary), start_time, end_time. Member_booked fields could be member_id, event_id, with maybe start_time and end_time, these two representing when the member is booked for an event. If a member is not found for a given event/time range in member_booked, presumably she's available. Note that event is generic, and could apply to any resource: meeting room equipment, meeting, etc. Downside to this, is that every member's scheduled event has to go into the member_event table, but it seems small so retrieval and update should be fast. Remember, this is a first kick at the can, and I'd bet there's a better way of doing it. Miles At 09:22 AM 8/21/2002 -0500, Matthew Crouch wrote: this is a big question and i'm not trying to get you to do my modelling for me, but if anyone has experience with this i'd appreciate being pointed in the right direction: How could one efficiently manage time slots in a dB? I mean for example telling the dB that Mike can be somewhere at 6:15 or 6:30 but not 6:45, and that Cynthia can be there at 6:15 or 7:00... ...and so on my instinct is to create a timeslots table, but it looks like it would contain 35,040 records (one for each 15-minute period in the year). egad! The alternative is to create timeslots a month at a time or something, but the table would have to be reformulated every month. any thoughts? feel free to get philosophical about it. -M -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] keeping form field data when reloading a form
Thanks, that works great. -- Chip Stuart McDonald [EMAIL PROTECTED] wrote on 08/20/2002 05:55:40 PM: Are you setting the variables in the form? Something like this - note the value field in the username field: form method=post action=index.php name=loginuser table summary=layout table to hold login data width=300 align=center cellpadding=1 cellspacing=0 border=0 bgcolor= #ff tr td align=leftp class=smallbUsername:/b/p/td td align=leftinput type=text name=username value=?php echo $username;? maxlength=50 size=15 style=width: 120px; font-size: 12px/td /tr tr td align=left p class=smallbPassword:/b/p/td td align=leftinput type=password name=password maxlength=50 size=15 style=width: 120px; font-size: 12px /tr tr td align=leftpnbsp; /p/td td align=leftpinput type=submit value=login name=login style=width: 50px; heigth: 18px; font-size: 12px/p/td /tr /table /form This way, depending on how youare refreshing the login form, if the $username variable passed your validation tests it should be set automatically into the form. Cheers Stuart - Original Message - From: [EMAIL PROTECTED] To: PHP_DB [EMAIL PROTECTED] Sent: Wednesday, August 21, 2002 12:58 AM Subject: [PHP-DB] keeping form field data when reloading a form I have my email checker working now, and all the other fields are checked also, but when I do enter some wrong data the form is reloaded with all blank fields. I'm sure there is a way to keep the existing data in the fields so the end-user will only have to change the incorrect fields, and not have to re-enter all the data. But how? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Printing?
Hi all... I'm useing SuSE 8.0, mysql, and PHP with a HP L5 printer. Could someone give me a hint on how to print a form to my HP? What I want to do is print (on paper G) monthly customer statements. Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Charts...
Hi all.. I'm using SuSE 8.0, mysql, and PHP4. Is it possible to make charts with a database? If so, how about a hint on it? Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Can't get data back into the database
contacts.php appears to have been chewed up ... fresh copy. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Charts...
On Thursday 22 August 2002 02:01, James Hatridge wrote: Hi all.. I'm using SuSE 8.0, mysql, and PHP4. Is it possible to make charts with a database? If so, how about a hint on it? Easiest way is to use an existing class: jpgraph or search on www.phpclasses.org -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* paranoia, n.: A healthy understanding of the way the universe works. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] form validation question - regex not working
I hope this isn't too far off topic - I have a regex for validating email addresses - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\. ([A-Za-z]{2,3})+$, $useremail)) Notice the {2,3} which is supposed to limit the last part to 2 or 3 letters, but I have been testing this and it allows as many letters as I put in there, but not 1 only. What's wrong? Also, when using eregi do I need to specify A-Za-z or just a-z, since it is case-insensitive? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Can't get data back into the database
Patrick Kirk said: Good Lord - its eaten contacts.php again! ?php /* Setup connection if ($grouping) // called as contacts.php?grouping?=blah // print table with group members elseif ($lastname) // called as contacts.php?lastname starts with blah // print table of suitable last names elseif ($organisation) // called as contacts.php?organisation starts with blah / print table of suitable organisation names elseif (person_id) // called as contacts.php?person_id=blah // print addedit form else //default case // called as contacts.php and show navigation tools */ ? ?php require (config.php); $db = mysql_pconnect($hostname,$user,$password); mysql_select_db(contacts,$db); if ($grouping) { // called as contacts.php?grouping?=blah // print table with group members printGrouping($grouping); } elseif ($person_id) { require (config.php); $db = mysql_pconnect($hostname,$user,$password); mysql_select_db(contacts,$db); $sql = SELECT * FROM people WHERE person_id=$person_id; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); $person_id = $myrow[person_id]; $first_name = $myrow[first_name]; $last_name = $myrow[last_name]; $organisation = $myrow[organisation]; $home_phone = $myrow[home_phone]; $work_phone = $myrow[work_phone]; $mobile_phone = $myrow[mobile_phone]; $dob = $myrow[dob]; $email1 = $myrow[email1]; $notes = $myrow[notes]; $title = $myrow[title]; $home_address = $myrow[home_address]; $work_address = $myrow[work_address]; $grouping = $myrow[grouping]; ? form method=post action=contacts.phpP body bgcolor=#A0B8C8 input type=hidden name=person_id value=?php echo $person_id ? titleContacts/?php echo $grouping ?/?php echo $first_name?nbsp?php echo $last_name?/title CENTERh3a href=?php echo $PHP_SELF?Contacts/anbsp/ nbspa href=?php echo $PHP_SELF??grouping=?php echo $grouping??php echo $grouping?/anbsp/ nbsp?php echo $first_name?nbsp?php echo $last_name?/h3/CENTER div align=center table width=100% border=1 tr tdFirst Name:/td tdinput name=first_name type=text id=first_name value=?php echo $first_name ? size=30/td tdLast Name:/td tdinput name=last_name type=text id=last_name value=?php echo $last_name ? size=30/td tdOrganisation:/td tdinput name=organisation type=text id=organisation value=?php echo $organisation ? size=30/td /tr tr tdHome Phone:/td tdinput name=home_phone type=text id=home_phone value=?php echo $home_phone ? size=30/td tdWork Phone:/td tdinput name=work_phone type=text id=work_phone value=?php echo $work_phone ? size=30/td tdMobile Phone:/td tdinput name=mobile_phone type=text id=mobile_phone value=?php echo $mobile_phone ? size=30/td /tr tr tdEmail:/td tdinput name=email1 type=text id=email1 value=?php echo $email1 ? size=30/td tdTitle:/td tdinput name=title type=text id=title value=?php echo $title? size=30/td tdDate of birth:/td tdinput name=textfield type=text value=?php echo $dob ? size=30/td /tr /table /div p align=centerHome Address: input name=home_address type=text id=home_address value=?php echo $home_address ? size=100 /p p align=centerWork Address: input name=work_address type=text id=work_address value=?php echo $work_address ? size=100 /p p align=centerGrouping: select name='grouping' option?php echo $grouping ?/option optionClub/option optionPlayers/option optionArchives/option optionEnterprise/option optionBusiness/option optionChildren/option optionPartners/option optionResources/option optionPersonal/option optionElizabeth Mews/option /select /p p align=centerNotes:/p p align=center textarea name=notes cols=100 rows=10 id=notes?php echo $notes ?/textarea/p p align=center input type=submit name=submit value=Enter information ?php } elseif ($submit) { // here if no ID then adding else we're editing if ($person_id) { require
Re: [PHP-DB] form validation question - regex not working
Chip, It's not so much off topic as a perennial topic - see archives and many tutorial articles. When you've worked out the answer to this question, please try out your algorithm on my (or any other 'foreign') address. Then consider the imminent introduction of further TLDs, eg .info (four characters), .family, etc. Regards, =dn PS Sorry, can't help with POSIX RegExs - I confuse myself without any outside assistance using the PCRE variants. I hope this isn't too far off topic - I have a regex for validating email addresses - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\. ([A-Za-z]{2,3})+$, $useremail)) Notice the {2,3} which is supposed to limit the last part to 2 or 3 letters, but I have been testing this and it allows as many letters as I put in there, but not 1 only. What's wrong? Also, when using eregi do I need to specify A-Za-z or just a-z, since it is case-insensitive? -- Chip Wiegand Computer Services Simrad, Inc www.simradusa.com [EMAIL PROTECTED] There is no reason anyone would want a computer in their home. --Ken Olson, president, chairman and founder of Digital Equipment Corporation, 1977 (They why do I have 9? Somebody help me!) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
On Thursday 22 August 2002 00:29, [EMAIL PROTECTED] wrote: I hope this isn't too far off topic - I have a regex for validating email addresses - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\. ([A-Za-z]{2,3})+$, $useremail)) Notice the {2,3} which is supposed to limit the last part to 2 or 3 letters, but I have been testing this and it allows as many letters as I put in there, but not 1 only. What's wrong? Also, when using eregi do I need to specify A-Za-z or just a-z, since it is case-insensitive? You're strongly advised not to write your own regex for validating email addresses. Your regex (once you get it working) will invalidate a lot of valid email addresses. Search archives, or google for some tried and tested regex which will do the job properly. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The most important things, each person must do for himself. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Charts...
AFAI, to make really nice, Excel-style, dynamical charts, the best way is to export your MySQL data into a SVG string (a XML document), which can be viewed directly by the client browser (at least with IE5+) Someday MySQL will have a SELECT ... OUTPUT XML capability... I am currently looking for SVG templates for making dynamical plot and line charts; I haven't found much on the web. Can anyone help? Thanks Ignatius Reilly - Original Message - From: James Hatridge To: PHP_DB Sent: Wednesday, August 21, 2002 8:01 PM Subject: [PHP-DB] Charts... Hi all.. I'm using SuSE 8.0, mysql, and PHP4. Is it possible to make charts with a database? If so, how about a hint on it? Thanks JIM -- Jim Hatridge Linux User #88484 -- BayerWulf Linux System # 129656 The Recycled Beowulf Project Looking for throw-away or obsolete computers and parts to recycle into a Linux super computer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
Jason, Concur with your advice, but was also amused by its juxtaposition with your sig file philosophy... =dn [snipped] I have a regex for validating email addresses - You're strongly advised not to write your own regex for validating email /* The most important things, each person must do for himself. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Date Subtraction
hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. Thanks, Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date Subtraction
Manoj, Just a couple of thoughts: First, I know this particular topic has been discussed here recently, so you might want to search the archives for more exhaustive information. Second, if you're using MySQL, check out the functions DATE_ADD() and MOD(). They're MySQL functions, so you'll have to implement them in your query, not the actual PHP code itself. These may or may not give you what you're looking for. You might have to drop the value of some kind of PHP variable into the DATE_ADD() INTERVAL parameter or something though. I looked quickly through the date functions in the PHP documentation and didn't find anything that would really manipulate the date for you (of course I may have missed it). The one thing that I did notice is that the PHP date and time functions return the SERVER date and time to you, not the local time for the user accessing your page. That might not be what you want. As I said before, I might have missed something, but that's what I found out after looking for all of two minutes. Rich -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 2:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Subtraction hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. Thanks, Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] gd Library config problem.......
Anyone know how to configure gd library (php4)? I uploaded PHP_INFO and this is what I got ~~~ './configure' '--with-apxs=apxs' '--prefix=/home/builder/psa-patch/psa/apache/../release/usr/local/psa/apache' '--with-system-regex' '--with-config-file-path=/usr/local/psa/apache/conf' '--disable-debug' '--disable-pear' '--enable-sockets' '--enable-track-vars' '--without-gd' '--with-mysql=/home/builder/psa-patch/psa/apache/../release/dist/usr/local/psa/mysql' '--with-iodbc=/home/builder/psa-patch/psa/apache/../release/lib/libiodbc' '--with-imap=/home/builder/psa-patch/psa/apache/../release/lib/imap-cclient' Notice that it says Without GD I want it to say With gd .. where di I go to fix this problem? Thanks, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Charts...
James. Many times I find myself wanting a quick and dirty bar chart using only HTML. You can do this simply by creating a one pixel image in any color you like. That way the download is only 1 pixel. Then calculate the width or height depending on if you want vertical or horizontal bars by placing the variable in the height or width and display the one pixel image as such: echo img SRC='images/blue.gif' WIDTH=$percent HEIGHT='18' ALIGN='BOTTOM' BORDER='0'; You can stack different colors. But you only get bar graphs. HTH. Dan. James Hatridge wrote: Hi all.. I'm using SuSE 8.0, mysql, and PHP4. Is it possible to make charts with a database? If so, how about a hint on it? Thanks JIM -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
Jason Wong [EMAIL PROTECTED] wrote on 08/21/2002 10:00:23 AM: On Thursday 22 August 2002 00:29, [EMAIL PROTECTED] wrote: I hope this isn't too far off topic - I have a regex for validating email addresses - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-]) +\. ([A-Za-z]{2,3})+$, $useremail)) Notice the {2,3} which is supposed to limit the last part to 2 or 3 letters, but I have been testing this and it allows as many letters as I put in there, but not 1 only. What's wrong? Also, when using eregi do I need to specify A-Za-z or just a-z, since it is case-insensitive? You're strongly advised not to write your own regex for validating email addresses. Your regex (once you get it working) will invalidate a lot of valid email addresses. Search archives, or google for some tried and tested regex which will do the job properly. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk This is from a php/mysql book. I added the parenthesis simply to group the sections, and added the {2,3} because a web site tutorial shows that will limit the preceding section to that many characters (2 or 3 only in this case). The script works fine without the {2,3}, and I may have to use it that way, since another response mentioned foreign addresses, I hadn't taken into account. I'd just like to know why it doesn't work, becuase the it's supposed to. -- Chip /* The most important things, each person must do for himself. */ Interesting tag considering your respoonse that I shouldn't do this mysqlf, eh? :-) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Date Subtraction
On Thursday 22 August 2002 02:23, Manoj Japher wrote: hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. mktime() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* The person who makes no mistakes does not usually make anything. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Date Subtraction
Oh, in MySQL, there's also DATE_SUB(). Forgot to mention that one. Rich -Original Message- From: Hutchins, Richard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 2:40 PM To: 'Manoj Japher'; [EMAIL PROTECTED] Subject: RE: [PHP-DB] Date Subtraction Manoj, Just a couple of thoughts: First, I know this particular topic has been discussed here recently, so you might want to search the archives for more exhaustive information. Second, if you're using MySQL, check out the functions DATE_ADD() and MOD(). They're MySQL functions, so you'll have to implement them in your query, not the actual PHP code itself. These may or may not give you what you're looking for. You might have to drop the value of some kind of PHP variable into the DATE_ADD() INTERVAL parameter or something though. I looked quickly through the date functions in the PHP documentation and didn't find anything that would really manipulate the date for you (of course I may have missed it). The one thing that I did notice is that the PHP date and time functions return the SERVER date and time to you, not the local time for the user accessing your page. That might not be what you want. As I said before, I might have missed something, but that's what I found out after looking for all of two minutes. Rich -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 2:23 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Date Subtraction hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. Thanks, Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP-DB] Date Subtraction
hi, hey you are bang on target. It did solve my problem. Thanks a lot, Manoj On Wed, 21 Aug 2002 [EMAIL PROTECTED] wrote : if you really just want yesterday, i use date(Y-m-d, time() - 86400); that way you'll get the correct info, no matter if it spans weeks, months, years etc i realize there could be flaws with this b/c it just subtracts 24hours, but it works Manoj Japher manojjapher@redif To: [EMAIL PROTECTED] fmail.com cc: Subject: [PHP-DB] Date Subtraction 08/21/2002 02:23 PM Please respond to Manoj Japher hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. Thanks, Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Re: problem with php and unixODBC
Marten, Look at the output of a phpinfo() when you have the putenv()'s - you can see that there are a couple of different environments here. Best regards, Andrew Hill Director of Technology Evangelism OpenLink Software http://www.openlinksw.com Universal Data Access Virtuoso Universal Server -Original Message- From: Marten Lehmann [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 14, 2002 4:59 AM To: Nick Gorham Cc: [EMAIL PROTECTED] Subject: [PHP-DB] Re: problem with php and unixODBC Hello, I know its a little late, but I have only just been pointed to your posting, I would guess the error you are getting database not found is coming from the sybase driver, not the driver manager. I solved the problem a week ago. It was just when I wanted to try iODBC when I saw some putenv()-lines in the examples. I put the appropriate lines in my php-script and then it worked. What I don't unterstand is: When I'm running isql in the shell I can connect to the remote-ressource. When I start apache in the same shell I can't connect through PHP, I first have to set the ODBCINSTINI and ODBCINI env-variables. Why don't I need them in the shell? Regards Marten -- Variomedia IT-Service GmbH | Benzstrasse 22 | 14482 Potsdam http://www.variomedia.de | Hotline: 0800-5588550 | Fax: 0331-7404043 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
On Thursday 22 August 2002 02:54, [EMAIL PROTECTED] wrote: This is from a php/mysql book. If they're presenting it as something that you can use in your real-life code then you should look carefully at all the other code in the book to see whether they're all as sloppy. On the other hand if they're only presenting it as an example on using regex then it's fine for learning with. I added the parenthesis simply to group the sections, and added the {2,3} because a web site tutorial shows that will limit the preceding section to that many characters (2 or 3 only in this case). The script works fine without the {2,3}, and I may have to use it that way, since another response mentioned foreign addresses, I hadn't taken into account. I'd just like to know why it doesn't work, becuase the it's supposed to. It's only checking for addresses of the form [EMAIL PROTECTED] As you can see, the list address ([EMAIL PROTECTED]), and my address ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is it? -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* His great aim was to escape from civilization, and, as soon as he had money, he went to Southern California. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
On Thu, 22 Aug 2002 03:10:02 +0800 Jason Wong [EMAIL PROTECTED] wrote: On Thursday 22 August 2002 02:54, [EMAIL PROTECTED] wrote: As you can see, the list address ([EMAIL PROTECTED]), and my address ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is it? Well, anyway there is only one sure way to valid email, confirmation message :-) pa -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
Jason Wong [EMAIL PROTECTED] wrote on 08/21/2002 12:10:02 PM: It's only checking for addresses of the form [EMAIL PROTECTED] As you can see, the list address ([EMAIL PROTECTED]), and my address ([EMAIL PROTECTED]) would be treated as invalid. Not very clever is it? Got it figured out, and foreign address do work now - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$, $useremail)) -- Chip -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
Regarding the good sense or otherwise for checking email addresses: This is from a php/mysql book... If it was from page 115, then please turn over to page 116! Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
Regarding the problem you are actually asking about: if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+([A-Za-z0-9\_-]) +\. ([A-Za-z]{2,3})+$, $useremail)) Notice the {2,3} which is supposed to limit the last part to 2 or 3 letters, but I have been testing this and it allows as many letters as I put in there, but not 1 only. What's wrong? Please be aware that I use PCRE not POSIX, but IIRC the last phrase says: ([A-Za-z]{2,3})+$ any upper or lower case letter, repeated twice or three times, and that appearing zero or more times, !!!??? appearing at the end of the string. Remove the + immediately before the terminating $. Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: gd Library config problem.......
Try asking in php.general. I use debian so it was easy for me to setup my PHP4 with all I needed :) -Joni- -- // Joni Järvinen // [EMAIL PROTECTED] // http://www.reactorbox.org/~wandu Dan Kelly [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Anyone know how to configure gd library (php4)? I uploaded PHP_INFO and this is what I got ~~~ './configure' '--with-apxs=apxs' '--prefix=/home/builder/psa-patch/psa/apache/../release/usr/local/psa/apache ' '--with-system-regex' '--with-config-file-path=/usr/local/psa/apache/conf' '--disable-debug' '--disable-pear' '--enable-sockets' '--enable-track-vars' '--without-gd' '--with-mysql=/home/builder/psa-patch/psa/apache/../release/dist/usr/local/p sa/mysql' '--with-iodbc=/home/builder/psa-patch/psa/apache/../release/lib/libiodbc' '--with-imap=/home/builder/psa-patch/psa/apache/../release/lib/imap-cclient' Notice that it says Without GD I want it to say With gd .. where di I go to fix this problem? Thanks, Dan -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: Date Subtraction
Use getdate() with mktime() and this is your solution. http://www.php.net/manual/en/function.getdate.php http://www.php.net/manual/en/function.mktime.php Adam
RE: [PHP-DB] Date Subtraction
What's more you can do some neat stuff with manipulating the timestamp to create very quick and accurate calendars. For instance for an application I had to build I had need of highlighting weeks on a calendar to change colors every two weeks, but any given day needed to know which color it should show. Since the increment of the timestamp is so predictible you can use the mod operator and do all kinds of neat stuff. Anyway, just another 2 cents worth. Ryan -Original Message- From: Manoj Japher [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 21, 2002 1:04 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Date Subtraction hi, hey you are bang on target. It did solve my problem. Thanks a lot, Manoj On Wed, 21 Aug 2002 [EMAIL PROTECTED] wrote : if you really just want yesterday, i use date(Y-m-d, time() - 86400); that way you'll get the correct info, no matter if it spans weeks, months, years etc i realize there could be flaws with this b/c it just subtracts 24hours, but it works Manoj Japher manojjapher@redif To: [EMAIL PROTECTED] fmail.com cc: Subject: [PHP-DB] Date Subtraction 08/21/2002 02:23 PM Please respond to Manoj Japher hi, Is there any way I can get previous day's date, like we get current date by using getdate() or date() function. I mean is there some in-built function in PHP which can subtract date to give me yesterday's date. I am currently calculating it using some code, which I have written and it is very tirng and recursive to check for each possible case. If someone has solved this before pls let me know. Thanks, Regards, Manoj 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php 'I have miles to go before I sleep, and promises to keep' -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] form validation question - regex not working
On Thursday 22 August 2002 04:01, [EMAIL PROTECTED] wrote: Got it figured out, and foreign address do work now - if (empty($useremail) || !eregi(^([A-Za-z0-9\.\_-])+@([A-Za-z0-9\_-])+\.([A-Za-z])+\.([a-z])*$, $useremail)) What do you mean by 'foreign' addresses? The above will still fail for: [EMAIL PROTECTED] -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Dungeons and Dragons is just a lot of Saxon Violence. */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL and BLOB
Hi there, I am storing via PHP pictures into BLOB fields. Worked fine so far for over 200 images. Now an error has occured with a particular picture. No error msg. Just does not work. The wired thing is that the thumbnail does. So I guess the BLOB field is just to small for the image. How many kb can a blob field savin in MySQL and what do you suggest to do. Thanx, Andy -- -- http://www.globosapiens.net Worldwide Travel Community -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MySQL and BLOB
On Thursday 22 August 2002 13:57, Andy wrote: Hi there, I am storing via PHP pictures into BLOB fields. Worked fine so far for over 200 images. Now an error has occured with a particular picture. No error msg. Just does not work. The wired thing is that the thumbnail does. So I guess the BLOB field is just to small for the image. How many kb can a blob field savin in MySQL Depends on what type of BLOB. Why don't you RFTM? and what do you suggest to do. Probably the usual, not to store files in MySQL where possible. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Never buy from a rich salesman. -- Goldenstern */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php