[PHP-DB] foreach()
Hi folks. wat can be done to dis: $z = array('foo' = array('bar')), 'dis' = array('dat')); foreach(//???) { echo //??? br //?? /p; } to output dis: foo bar dis dat - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? The all-new My Yahoo! What will yours do?
Re: [PHP-DB] foreach()
Try this : -- $z = array('foo' = array('bar')), 'dis' = array('dat')); while (list($key, $val) = each($z)) { echo BR$key $val; } - Original Message - From: Yemi Obembe [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Monday, January 31, 2005 9:47 AM Subject: [PHP-DB] foreach() Hi folks. wat can be done to dis: $z = array('foo' = array('bar')), 'dis' = array('dat')); foreach(//???) { echo //??? br //?? /p; } to output dis: foo bar dis dat - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? The all-new My Yahoo! - What will yours do? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] foreach()
try... $z = array('foo' = array('bar'), 'dis' = array('dat')); foreach($z as $key = $value) { echo $key br $value[0] /p; } graeme. Yemi Obembe wrote: Hi folks. wat can be done to dis: $z = array('foo' = array('bar')), 'dis' = array('dat')); foreach(//???) { echo //??? br //?? /p; } to output dis: foo bar dis dat - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? The all-new My Yahoo! What will yours do? -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] foreach()
or even... $z = array('foo' = array('bar'), 'dis' = array('dat')); while (list($key, $val) = each($z)) { echo $keyBR $val[0]p; } You need to remove the superfluous close bracket on after bar, and the val is an array hence $val[0] to get the element displayed. graeme. Han wrote: Try this : -- $z = array('foo' = array('bar')), 'dis' = array('dat')); while (list($key, $val) = each($z)) { echo BR$key $val; } - Original Message - From: Yemi Obembe [EMAIL PROTECTED] To: php-db@lists.php.net Sent: Monday, January 31, 2005 9:47 AM Subject: [PHP-DB] foreach() Hi folks. wat can be done to dis: $z = array('foo' = array('bar')), 'dis' = array('dat')); foreach(//???) { echo //??? br //?? /p; } to output dis: foo bar dis dat - A passion till tomorrow, Opeyemi Obembe | ng.clawz.com - Do you Yahoo!? The all-new My Yahoo! - What will yours do? -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] timestamp
This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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: [PHP-DB] SQL prob
Thanks, but DISTINCT doesn't work... But I managed to get it to work anyway by including namn_1 NOT LIKE 'H%' in the second WHERE-clause... Micah Stevens wrote: use DISTINCT? On Sunday 30 January 2005 12:51 pm, Bobo Wieland wrote: Anyone that can help me with this one? I want this SQL-statement to retrive only distinct values from the original table column named (not the AS stuff) ( SELECT * , namn_2 AS sec_namn, namn_1 AS one FROM sortiment WHERE namn_1 LIKE 'H%' ) UNION ( SELECT * , UPPER( namn_2 ) AS sec_namn, namn_2 AS one FROM sortiment WHERE namn_2 LIKE 'H%' AND SUBSTRING( namn_2, 1, 1 ) LIKE BINARY 'H' ) ORDER BY one LIMIT 0 , 10 this will return, for example, the following row twice where (in the original table) namn_1 = Humulus lupulus namn_2 = Humle the two rows are identical except for the sec_namn and one created by the query. They are set to: sec_namn one HUMLEHumle HumleHumulus lupulus _bobo wieland _ [EMAIL PROTECTED] _ winamp Not playing anything right now... -- _bobo wieland _ [EMAIL PROTECTED] _ winamp Not playing anything right now... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] timestamp
dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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: [PHP-DB] timestamp
pls post relevant code bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 01 Feb 2005 10:13:40 +0530 dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] timestamp
i just copy your code and paste into a test file. ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? with best wishes balwant On Tue, 2005-02-01 at 10:33, Bastien Koert wrote: pls post relevant code bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 01 Feb 2005 10:13:40 +0530 dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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 Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] timestamp
Can you post your code up and tell us what system you are using? cheers, graeme Balwant Singh wrote: dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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 -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim
Re: [PHP-DB] timestamp
The code works fine on my system, so what version of php are you using and what is your operating system? graeme. Balwant Singh wrote: i just copy your code and paste into a test file. ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? with best wishes balwant On Tue, 2005-02-01 at 10:33, Bastien Koert wrote: pls post relevant code bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 01 Feb 2005 10:13:40 +0530 dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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 -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim
Re: [PHP-DB] timestamp
what output do you get from the following? ?php $timestamp = Fri Jan 28 19:53:09 2005; echo $timestamp .br; $date = date(Y-m-d,strtotime($timestamp)); echo $date .br; phpinfo(); ? graeme wrote: The code works fine on my system, so what version of php are you using and what is your operating system? graeme. Balwant Singh wrote: i just copy your code and paste into a test file. ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? with best wishes balwant On Tue, 2005-02-01 at 10:33, Bastien Koert wrote: pls post relevant code bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 01 Feb 2005 10:13:40 +0530 dear bastien thanks for the reply... but i checked it again but it is giving only 1970-01-01. is something else needs to be done. with best wishes balwant On Mon, 2005-01-31 at 19:46, Bastien Koert wrote: This code : ? $timestamp = Fri Jan 28 19:53:09 2005; $date = date(Y-m-d,strtotime($timestamp)); echo $date; ? gave me this result 2005-01-28 Exactly as it should. Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Bastien Koert [EMAIL PROTECTED] CC: php-db@lists.php.net Subject: RE: [PHP-DB] timestamp Date: 31 Jan 2005 10:02:04 +0530 thanks I tried strtotime also but getting 1970-01-01 not 2005-01-28. my problem is that the date is given to me in string format i.e.Fri Jan 28 19:53:09 2005. Any other help will be appreciated. with best wishes balwant On Sat, 2005-01-29 at 22:45, Bastien Koert wrote: try $date = date(Y-m-d,strtotime($timestamp)); Best thing to use if you want to do calcs on date/time data is to use the unix time stamp...translates the timestamp into seconds since 01-01-1970...Much simpler to use in sql queries Bastien From: Balwant Singh [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: php-db@lists.php.net Subject: [PHP-DB] timestamp Date: 29 Jan 2005 19:47:35 +0530 i am facing a problem i have timestamp in string format -- Fri Jan 28 19:53:09 2005 now i want to get the date from it. is it possible? pls. help. on using strftime(%D,$timestamp) it is giving 01/01/70. May pls. help me. Also pls. let me know whether calculation can be done in mysql on this string timestamp. pls. inform. with best wishes balwant -- 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 -- Experience is a good teacher, but she sends in terrific bills. Minna Antrim -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php