php-general Digest 20 Oct 2012 12:23:47 -0000 Issue 8015
php-general Digest 20 Oct 2012 12:23:47 - Issue 8015 Topics (messages 319521 through 319525): Re: Table help needed 319521 by: admin 319522 by: tamouse mailing lists User Timezone 319523 by: Karl DeSaulniers 319525 by: Maciek Sokolewicz Missing email 319524 by: Karl DeSaulniers 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--- -Original Message- From: Chris Payne [mailto:oxygene...@gmail.com] Sent: Friday, October 19, 2012 7:01 PM To: php-gene...@lists.php.net Subject: [PHP] Table help needed Hi everyone, So i'm stuck, and I admit it. I have to (QUICKLY) display information from a database, easy. But the formatting they want is in a HTML table, 3 columns at a time and unlimited rows - how can I display 3 columns across at a time? Please help, it's a last minute thing !!! Chris $query = SELECT * TABLE; $result = mysql_query($query); If(mysql_num_rows($result) = 1) { Echo table; While($row = mysql_fetch_assoc($result)) { Echo TRTD.$row[field1]./TDTD.$row[field2]./TDTD.$row[field3]. /TD/TR } Echo /table; } ---End Message--- ---BeginMessage--- On Fri, Oct 19, 2012 at 6:09 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Chris Payne [mailto:oxygene...@gmail.com] Sent: Friday, October 19, 2012 7:01 PM To: php-gene...@lists.php.net Subject: [PHP] Table help needed Hi everyone, So i'm stuck, and I admit it. I have to (QUICKLY) display information from a database, easy. But the formatting they want is in a HTML table, 3 columns at a time and unlimited rows - how can I display 3 columns across at a time? Please help, it's a last minute thing !!! Chris $query = SELECT * TABLE; $result = mysql_query($query); If(mysql_num_rows($result) = 1) { Echo table; While($row = mysql_fetch_assoc($result)) { Echo TRTD.$row[field1]./TDTD.$row[field2]./TDTD.$row[field3]. /TD/TR } Echo /table; } Surprised no one else has jumped on the Don't use mysql anymore thing here. Quick and dirty PDO implementation: https://gist.github.com/3922192 ---End Message--- ---BeginMessage--- Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Any help is appreciated. Best, Karl DeSaulniers Design Drumm http://designdrumm.com ---End Message--- ---BeginMessage--- On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and
[PHP] User Timezone
Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Any help is appreciated. Best, Karl DeSaulniers Design Drumm http://designdrumm.com
[PHP] Re: User Timezone
On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image-creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Table help needed
On 20-10-2012 07:52, tamouse mailing lists wrote: Surprised no one else has jumped on the Don't use mysql anymore thing here. Quick and dirty PDO implementation: https://gist.github.com/3922192 I'm actually more surprised that the OP hasn't even bothered to check the standard HTML syntax for table and find out himself. If you don't know how to make a table with 3 columns, that indicates you have no clue how to make an HTML table in the first place. So my advice to the OP: go learn some HTML first, before acting as-if you were a PHP expert. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Re: User Timezone
Have you tried Google Timezone API? (https://developers.google.com/maps/documentation/timezone/) I don't know if it's free to use, probably not. You may note that you need user's longitude/latitude to query this API. A solution is to query Google Places API (https://developers.google.com/places/) based on the State name, or use the HTML5 Geolocation API (http://www.w3schools.com/html/html5_geolocation.asp, I won't recommend as AFAIK it is not stable, others could correct me). Hope it helps. Cheers, Samuel. -Mensagem original- De: Maciek Sokolewicz [mailto:tula...@gmail.com] Em nome de Maciek Sokolewicz Enviada em: sábado, 20 de outubro de 2012 09:24 Para: Karl DeSaulniers Cc: php-general Assunto: [PHP] Re: User Timezone On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image-creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Missing email
On Sat, Oct 20, 2012 at 5:00 AM, Karl DeSaulniers k...@designdrumm.com wrote: @Moderator Any reason why my emails do not post or at least dont post for hours later? There is no moderator on this list. I'm probably about as close as it comes. Can you explain more about the problems you're experiencing so that I can look into it further? -- /Daniel P. Brown Network Infrastructure Manager http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Table help needed
On 10/20/2012 8:26 AM, Maciek Sokolewicz wrote: On 20-10-2012 07:52, tamouse mailing lists wrote: Surprised no one else has jumped on the Don't use mysql anymore thing here. Quick and dirty PDO implementation: https://gist.github.com/3922192 I'm actually more surprised that the OP hasn't even bothered to check the standard HTML syntax for table and find out himself. If you don't know how to make a table with 3 columns, that indicates you have no clue how to make an HTML table in the first place. So my advice to the OP: go learn some HTML first, before acting as-if you were a PHP expert. - Tul exactly! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Table help needed
-Original Message- From: tamouse mailing lists [mailto:tamouse.li...@gmail.com] Sent: Saturday, October 20, 2012 1:53 AM To: admin Cc: Chris Payne; php-general@lists.php.net Subject: Re: [PHP] Table help needed On Fri, Oct 19, 2012 at 6:09 PM, admin ad...@buskirkgraphics.com wrote: -Original Message- From: Chris Payne [mailto:oxygene...@gmail.com] Sent: Friday, October 19, 2012 7:01 PM To: php-general@lists.php.net Subject: [PHP] Table help needed Hi everyone, So i'm stuck, and I admit it. I have to (QUICKLY) display information from a database, easy. But the formatting they want is in a HTML table, 3 columns at a time and unlimited rows - how can I display 3 columns across at a time? Please help, it's a last minute thing !!! Chris $query = SELECT * TABLE; $result = mysql_query($query); If(mysql_num_rows($result) = 1) { Echo table; While($row = mysql_fetch_assoc($result)) { Echo TRTD.$row[field1]./TDTD.$row[field2]./TDTD.$row[fiel d3]. /TD/TR } Echo /table; } Surprised no one else has jumped on the Don't use mysql anymore thing here. Quick and dirty PDO implementation: https://gist.github.com/3922192 Chris, Let me first apologize for a couple syntax errors I had in the real quick explanation. I answered your question in relationship to your knowledge of the subject based on the question it's self. I want to apologize for the comments that followed my reply, seems some people can't make constructive comments if their life depended on it. While the more complex version in PDO is the preferred method to obtain objects from mysql. This does require you to have the basic fundamentals of object oriented programming skills, which I am guessing at this point you do not have based on how the question was phrased. There are many people in the list who will gladly point you in the direction to learning aids and tutorials to get you started. Good Luck :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Table help needed
On 20-10-2012 21:52, admin wrote: Chris, Let me first apologize for a couple syntax errors I had in the real quick explanation. I answered your question in relationship to your knowledge of the subject based on the question it's self. I want to apologize for the comments that followed my reply, seems some people can't make constructive comments if their life depended on it. While the more complex version in PDO is the preferred method to obtain objects from mysql. This does require you to have the basic fundamentals of object oriented programming skills, which I am guessing at this point you do not have based on how the question was phrased. There are many people in the list who will gladly point you in the direction to learning aids and tutorials to get you started. Good Luck :) Hi admin (whoever you are), from your message I guess you are reacting to my reply. I dislike that you say that I can't make constructive comments if their [my] life depended on it based on a single post. In my defense, I first of all wasn't talking to the OP directly, but rather adding to a remark by Tamara (tamouse). This remark contained the exact steps that the OP should have followed to actually get anywhere (though not at all in detail, I must admit). Whereas with the steps you provided: just use this code, the OP will 'use' it and not learn a damned thing. Anyway, what I wanted to say is: please don't be overly critical about the reactions you see when people respond to questions which show an obvious lack of trying (where a simple google search would answer the question). And if you do want to be that critical, do it on a personal level. In other words: contact me personally, not hidden inside a message which has nothing to do with it. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: User Timezone
On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote: On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image-creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul Thanks for the response. Yes, for the US I plan on calculating by state, but this website is not geared to just the US. So I am looking for a solution that lets me also calculate by country/ region. Was looking on google and found geoip, but not sure if this will do the job I am looking for. Anyone with experience on geoip that can send pointers? Thanks, Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Re: User Timezone
Dont know how I would get longitude and latitude of my users. Also, not using HTML5 except for layout reasons. Liquid canvas. So I am using HTML 4 transitional for structure. Thanks for the response! I will at least look into your solution. Couldn't hurt. :) Best, Karl On Oct 20, 2012, at 7:35 AM, Samuel Lopes Grigolato wrote: Have you tried Google Timezone API? (https://developers.google.com/maps/documentation/timezone/) I don't know if it's free to use, probably not. You may note that you need user's longitude/latitude to query this API. A solution is to query Google Places API (https://developers.google.com/places/) based on the State name, or use the HTML5 Geolocation API (http://www.w3schools.com/html/html5_geolocation.asp , I won't recommend as AFAIK it is not stable, others could correct me). Hope it helps. Cheers, Samuel. -Mensagem original- De: Maciek Sokolewicz [mailto:tula...@gmail.com] Em nome de Maciek Sokolewicz Enviada em: sábado, 20 de outubro de 2012 09:24 Para: Karl DeSaulniers Cc: php-general Assunto: [PHP] Re: User Timezone On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image-creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: User Timezone
On Sun, Oct 21, 2012 at 12:56 AM, Karl DeSaulniers k...@designdrumm.com wrote: On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote: On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image-creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul Thanks for the response. Yes, for the US I plan on calculating by state, but this website is not geared to just the US. So I am looking for a solution that lets me also calculate by country/region. Was looking on google and found geoip, but not sure if this will do the job I am looking for. Anyone with experience on geoip that can send pointers? Thanks, Best, Karl DeSaulniers Design Drumm http://designdrumm.com Geo IP is based on IP, and I must warn you that IP data is not always accurate. Especially here in Europe, companies that are based in multiple countries sometimes only register their IPs in a single country, and share them between all the countries they are active in. This will give you wrong data from GeoIP. The time difference will only be 1 hour at max, but still. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: User Timezone
On Oct 20, 2012, at 6:02 PM, Matijn Woudt wrote: On Sun, Oct 21, 2012 at 12:56 AM, Karl DeSaulniers k...@designdrumm.com wrote: On Oct 20, 2012, at 7:23 AM, Maciek Sokolewicz wrote: On 20-10-2012 09:39, Karl DeSaulniers wrote: Hello all, Happy weekend. Hoping you can help me with an age old question. I am trying to get a users timezone for a purchase online. I know that php is not really able to get a timzone of a user because its a server side execution with the date functions. But I wanted to get a little help on my work around. I am hoping someone can help. TIA I have a form that a user must fill out in order to purchase anything. On this form they are required to put their city, state, country and zip code. These are all required fields. Now, I know there is a way to get a timezone offset if you have a location to offset. So is there a way based on the fields provided that I can get that offset for each user? (The users have to put a correct city, state, country and zip in order to get there purchase. This address has to match their paypal or cc address in order to purchase as well. So I know there will still be a margin of error with user manipulated info. So that is moot point for now.) My thoughts are to get a timezone offset based on the country and zip code, with a backup check of city state country zip. I just don't know where to start looking for how to get the timezone or UTC location based on country and zip or city state country zip. Hi Karl, so basically what you're looking for is a database map between timezone and country/state/zip. Did you try to google such a thing? One of the first posts I found was a StackOverflow question about this; one of the answers mentioned just such a database on Tom Boutell's website (the same person who created the GD library [used for image- creation in php]): http://www.boutell.com/zipcodes/ It includes states, cities, zip codes, etc. for the USA. Since you specifically mentioned you want to find it by state, it means you're mainly focussing on the USA (barely any other country even bothers with states). Apart from the above data, I'm sure you can find more on google. Good luck. - Tul Thanks for the response. Yes, for the US I plan on calculating by state, but this website is not geared to just the US. So I am looking for a solution that lets me also calculate by country/region. Was looking on google and found geoip, but not sure if this will do the job I am looking for. Anyone with experience on geoip that can send pointers? Thanks, Best, Karl DeSaulniers Design Drumm http://designdrumm.com Geo IP is based on IP, and I must warn you that IP data is not always accurate. Especially here in Europe, companies that are based in multiple countries sometimes only register their IPs in a single country, and share them between all the countries they are active in. This will give you wrong data from GeoIP. The time difference will only be 1 hour at max, but still. That was what my own suspicions were leading to. I am familiar with the fact that ips can be spoofed. Thanks for the corroboration. Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php