[PHP] datetime
I am using a mssql database and I have a question regarding the datetime type. When I write a date to the database it store the date in the following format: 6/8/03 But when I extract the date from the database it returns the value in the following format: Jun 8 2003 12:00AM Is there a nice function available in php that will format the date based upon certain specification. I know that date() exists, but I that means I would have to use mktime() which would require parsing the entire string and breaking the string into the day, the month, the year. Furthermore, I would then need a switch statement to convert the value Jun into the value 6. I appreciate any help. Thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] datetime
Use date() and strtotime() together. strtotime will convert date string into integer timestamp. Still have any questions, check these two functions online plz. Dale Hersh [EMAIL PROTECTED] 08/22/2003 10:13 AM To: [EMAIL PROTECTED] cc: Subject:[PHP] datetime I am using a mssql database and I have a question regarding the datetime type. When I write a date to the database it store the date in the following format: 6/8/03 But when I extract the date from the database it returns the value in the following format: Jun 8 2003 12:00AM Is there a nice function available in php that will format the date based upon certain specification. I know that date() exists, but I that means I would have to use mktime() which would require parsing the entire string and breaking the string into the day, the month, the year. Furthermore, I would then need a switch statement to convert the value Jun into the value 6. I appreciate any help. Thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] datetime
Convert Jun 8 2003 12:00AM to a timestamp which can then be used with the date() function to format the date to whatever format you want. Lets say you've inserted the date as '6/8/03' and you want the data to remain the same when you retrieve it: ? $ts = strtotime(Jun 8 2003 12:00AM); echo date(n/j/y, $ts); ? so all you have to do is replace Jun 8 2003 12:00AM with data retrieved from the DB -Original Message- From: Dale Hersh [mailto:[EMAIL PROTECTED] Sent: Friday, 22 August 2003 12:13 To: [EMAIL PROTECTED] Subject: [PHP] datetime I am using a mssql database and I have a question regarding the datetime type. When I write a date to the database it store the date in the following format: 6/8/03 But when I extract the date from the database it returns the value in the following format: Jun 8 2003 12:00AM Is there a nice function available in php that will format the date based upon certain specification. I know that date() exists, but I that means I would have to use mktime() which would require parsing the entire string and breaking the string into the day, the month, the year. Furthermore, I would then need a switch statement to convert the value Jun into the value 6. I appreciate any help. Thanks, Dale -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php * This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more information, visit our website at www.salmat.com.au. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Easy XML PHP tutorials ?????
On Friday, August 22, 2003, 2:16:06 AM, Joe wrote: JH Hello all. does anyone have any very easy XML tutorials . I have a JH simple weather feed I want to implement. but no XML experience JH thanks shameless plug I have one at my site, complete with an example and downloadble code. I also wrote a class that parses an XML weather feed. Are you trying to use the intercept vector xml feeds? Anyhow, the tutorial is at my site (check the signature). Click on PHP under the sections on the left. /shameless plug If you don't find mine too useful, there are plenty of other tutorial sites around. My favorite one is at zend http://www.zend.com/zend/tut/ -- Regards, Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stopping Output
I'm in the process of making a forum in PHP, and am wondering if there is a way to just stop sending stuff the the client(like if they're banned). I'm including a php file in all the .php files that make up the forum(reads the forum configuration file, sets up style sheets, etc). I'd really like to be able to put the code in there, so if/when I update it I won't have to update 20 different files. return 0; stops everything in the included file, but everything from file that inlcuded it still shows still goes on printing. Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to make an argument optional...confirmation...
I want to create a function with an optional argument/parameter but have never read a concrete answer on how to do it. This is what I am assuming function test(arg1,arg2,arg3 = null) { arg3 will be optional } is this correct? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] google style paginating
PEAR::DB_Pager is a good example of how to do this. The getData function is all you need. http://pear.php.net/DB_Pager http://cvs.php.net/co.php/pear/DB_Pager/Pager.php?login=2r=1.4 olinux --- Ted Conn [EMAIL PROTECTED] wrote: Hi I am new to this newsgroup and I plan on replying to all the posts I can for now... but Id like to start out by asking a question. I am trying to paginate my sql results in 10 by 10, which I have been able to do no problem. but what I want to do is have the pages layed out in google style with (1)(2)(3)(4) etc etc and each one is clickeable that will take you to that page. I'll show you the code I am using now for next and back buttons... __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to open random Flash page with hyperlink?
Hey everyone, I'm new to using PHP so please bear with me. I'm trying to create a hyperlink that will open a random Flash page so that users will see a different flash module each time. Here is some of the code that I wrote but I'm not sure if it'll work since I'm not very good at coding. Oh yeah, I'm not using a database either. // random_menu.html head ?php $i = rand(0,3); ? /head body a href = www.x.com/random.php?i=$ix/a /body --- // random.php head ?php $i = $_post[i]; if ($i = = 0){ $value = a; } else if ($i = = 1){ $value = b; } ...etc. /head body object param name=movie value=$value embed src=$value/embed /object /body Please help if you know how to do this. Thanks in advance. phil* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to make an argument optional...confirmation...
function test($arg1, $arg2, $arg3 = ) { if(isset($arg3)) { // do whatever with $arg3 } } -Original Message- From: Jonathan Villa [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 7:56 PM To: [EMAIL PROTECTED] Subject: [PHP] How to make an argument optional...confirmation... I want to create a function with an optional argument/parameter but have never read a concrete answer on how to do it. This is what I am assuming function test(arg1,arg2,arg3 = null) { arg3 will be optional } is this correct? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to make an argument optional...confirmation...
Hi, Friday, August 22, 2003, 12:55:37 PM, you wrote: JV I want to create a function with an optional argument/parameter but have JV never read a concrete answer on how to do it. JV This is what I am assuming JV function test(arg1,arg2,arg3 = null) JV { JV arg3 will be optional JV } JV is this correct? Yes that is correct, you don't have to use null any value can be put in as a default. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to make an argument optional...confirmation...
Great, thanks!! On Thu, 2003-08-21 at 22:20, Tom Rogers wrote: Hi, Friday, August 22, 2003, 12:55:37 PM, you wrote: JV I want to create a function with an optional argument/parameter but have JV never read a concrete answer on how to do it. JV This is what I am assuming JV function test(arg1,arg2,arg3 = null) JV { JV arg3 will be optional JV } JV is this correct? Yes that is correct, you don't have to use null any value can be put in as a default. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to open random Flash page with hyperlink?
Phillip, pretty close. only a few things that are missing/incorrect. my corrections are marked by a # -Original Message- From: Phillip Pang [mailto:[EMAIL PROTECTED] // random_menu.html head ?php $i = rand(0,3); ? /head body a href = www.x.com/random.php?i=$ix/a # you need to go back to php mode to use $i a href = www.x.com/random.php?i=? echo $i ?x/a /body --- // random.php head ?php $i = $_post[i]; # im pretty sure the value would be past via the GET method as the user would be clicking the hyperlink, so it should look like $i = $_GET[i]; if ($i = = 0){ # there shouldnt be any spaces for the comparison if ($i == 0){ $value = a; } else if ($i = = 1){ # there shouldnt be any spaces for the comparison else if ($i == 1){ $value = b; } ...etc. # dont forget to get out of php mode ? /head body object param name=movie value=$value # need to go back to php mode to use $value param name=movie value=? echo $value ? embed src=$value/embed # need to go back to php mode to use $value embed src=? echo $value ?/embed /object /body Please help if you know how to do this. Thanks in advance. phil* hope that helps Cody * This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more information, visit our website at www.salmat.com.au. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to open random Flash page with hyperlink?
Hello some more changes param name=movie value=?php echo $value ? embed src=?php echo $value ?/embed -murugesan - Original Message - From: Cody Phanekham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 22, 2003 9:32 AM Subject: RE: [PHP] How to open random Flash page with hyperlink? Phillip, pretty close. only a few things that are missing/incorrect. my corrections are marked by a # -Original Message- From: Phillip Pang [mailto:[EMAIL PROTECTED] // random_menu.html head ?php $i = rand(0,3); ? /head body a href = www.x.com/random.php?i=$ix/a # you need to go back to php mode to use $i a href = www.x.com/random.php?i=? echo $i ?x/a /body --- // random.php head ?php $i = $_post[i]; # im pretty sure the value would be past via the GET method as the user would be clicking the hyperlink, so it should look like $i = $_GET[i]; if ($i = = 0){ # there shouldnt be any spaces for the comparison if ($i == 0){ $value = a; } else if ($i = = 1){ # there shouldnt be any spaces for the comparison else if ($i == 1){ $value = b; } ...etc. # dont forget to get out of php mode ? /head body object param name=movie value=$value # need to go back to php mode to use $value param name=movie value=?php echo $value ? embed src=$value/embed # need to go back to php mode to use $value embed src=?php echo $value ?/embed /object /body Please help if you know how to do this. Thanks in advance. phil* -murugesan
RE: [PHP] Easy XML PHP tutorials ?????
Burhan! Thanks a lot... This is great... I am going through it right ... Have a great day! Joe -Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 10:35 PM To: Joe Harman; [EMAIL PROTECTED] Subject: Re: [PHP] Easy XML PHP tutorials ? On Friday, August 22, 2003, 2:16:06 AM, Joe wrote: JH Hello all. does anyone have any very easy XML tutorials . I have a JH simple weather feed I want to implement. but no XML experience JH thanks shameless plug I have one at my site, complete with an example and downloadble code. I also wrote a class that parses an XML weather feed. Are you trying to use the intercept vector xml feeds? Anyhow, the tutorial is at my site (check the signature). Click on PHP under the sections on the left. /shameless plug If you don't find mine too useful, there are plenty of other tutorial sites around. My favorite one is at zend http://www.zend.com/zend/tut/ -- Regards, Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] How to open random Flash page with hyperlink?
-Original Message- From: murugesan [mailto:[EMAIL PROTECTED] some more changes param name=movie value=?php echo $value ? embed src=?php echo $value ?/embed Murugesan, both ways are correct. Its just that i'm used to using the short open tag :) http://au.php.net/manual/en/configuration.directives.php#ini.short-open-tag http://au.php.net/manual/en/configuration.directives.php#ini.short-open-tag short_open_tag http://au.php.net/manual/en/language.types.boolean.php boolean Tells whether the short form (? ?) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use ?xml ? inline. Otherwise, you can print it with PHP, for example: ?php echo '?xml version=1.0'; ?. Also if disabled, you must use the long form of the PHP open tag (?php ?). Note: This directive also affects the shorthand ?=, which is identical to ? echo. Use of this shortcut requires short_open_tag to be on. - Original Message - From: Cody Phanekham mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] To: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] Sent: Friday, August 22, 2003 9:32 AM Subject: RE: [PHP] How to open random Flash page with hyperlink? Phillip, pretty close. only a few things that are missing/incorrect. my corrections are marked by a # -Original Message- From: Phillip Pang [mailto:[EMAIL PROTECTED] // random_menu.html head ?php $i = rand(0,3); ? /head body a href = x http://www.x.com/random.php?i=$i www.x.com/random.php?i=$ix/a # you need to go back to php mode to use $i a href = http://www.x.com/random.php?i www.x.com/random.php?i=? echo $i ?x/a /body --- // random.php head ?php $i = $_post[i]; # im pretty sure the value would be past via the GET method as the user would be clicking the hyperlink, so it should look like $i = $_GET[i]; if ($i = = 0){ # there shouldnt be any spaces for the comparison if ($i == 0){ $value = a; } else if ($i = = 1){ # there shouldnt be any spaces for the comparison else if ($i == 1){ $value = b; } ...etc. # dont forget to get out of php mode ? /head body object param name=movie value=$value # need to go back to php mode to use $value param name=movie value=?php echo $value ? embed src=$value/embed # need to go back to php mode to use $value embed src=?php echo $value ?/embed /object /body Please help if you know how to do this. Thanks in advance. phil* -murugesan * This e-mail, including any attachments to it, may contain confidential and/or personal information. If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or take any action based on the information contained within it. Please notify the sender immediately by return e-mail of the error and then delete the original e-mail. The information contained within this e-mail may be solely the opinion of the sender and may not necessarily reflect the position, beliefs or opinions of Salmat on any issue. This email has been swept for the presence of computer viruses known to Salmat's anti-virus systems. For more information, visit our website at www.salmat.com.au. *
[PHP] Re: Stopping Output
Oliver wrote: I'm in the process of making a forum in PHP, and am wondering if there is a way to just stop sending stuff the the client(like if they're banned). What about exit or die? Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: error when using $this
Jonathan Villa wrote: I am in a class as well as a constructor. class DBI { //var declarations function DBI() { $retVal = true; $this-setDBConn(mysql_connect('localhost',$this-_dbuser,$this-_dbpwd)); if ($this-getDBConn() == false) $retVal = false; if(mysql_select_db($this-getDBName(),$this-getDBConn())==false) $retVal = false; return $retVal; } //more functions... } I'm guessing this is your class constructor? If so then you can't access $this-_dbuser and $this-_dbpw because you have not set their value anywhere. You cannot set their value in the section you labeled var declarations either. PHP does not allow values to be assigned to variables outside of functions. So if you have any assignments in the var declaration section put those at the top of your constructor. Jean-Christian Imbeault -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] timestamp
Not teasing, I know I could do this with some ready made script, but I want to make my own. I'm making a counter. CREATE TABLE `counter` ( `IPAddress` VARCHAR NOT NULL , `RemoteHost` VARCHAR NOT NULL , `TimeStamp` TIMESTAMP NOT NULL, `Date` VARCHAR NOT NULL ) Question 1, how do I create a timestamp, (My SQL above does not work.), if this is indeed what I want to do. Question 2, how can I read TimeStamp and if the elapsed time between visits is more than 60 minutes, I insert a new record? Where do I start? I can do somethng similar with cookies in Javascript and this is the format, I imagine???, I would use: var expdate = new Date(); // Set cookie to expire in 1 hour // 1000 milliseconds (milliseconds per second) // * 60 milliseconds (seconds per minute) // * 60 milliseconds (minutes per hour) // * 1 milliseconds (hours per day) // * 1 milliseconds (days) expdate.setTime (expdate.getTime() + (1000*60*60*1*1)); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT-Re: worm on th list
On Wed, Aug 20, 2003 at 11:11:43AM -0400, andu wrote: Is this worm/virus windows specific? It appears so but considering a good percent of users are MS/Outlook users this is a bad one. Got over 100 yesterday, 100+ the day before and looking at the same today. Considering I hardly ever have seen a wild virus emailed to me, this is a bad one. -- Jerry M. Howell II -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php