[PHP-DB] date function
Hi guys, This might not be the best place for this but here goes. I want to create a dropdown list with a date range of -- SELECT name=bdate OPTION value=11/02/2003 SELECTEDToday OPTION value=11/01/2003Yesterday OPTION value=10/31/2003Fri 10/31 OPTION value=10/30/2003Thu 10/30 OPTION value=10/29/2003Wed 10/29 OPTION value=10/28/2003Tue 10/28 OPTION value=10/27/2003Mon 10/27 OPTION value=10/26/2003Sun 10/26 OPTION value=10/25/2003Sat 10/25 OPTION value=10/24/2003Fri 10/24 OPTION value=10/23/2003Thu 10/23 OPTION value=10/22/2003Wed 10/22 OPTION value=10/21/2003Tue 10/21 OPTION value=10/20/2003Mon 10/20 OPTION value=10/19/2003Sun 10/19 OPTION value=10/12/2003Sun 10/12 OPTION value=10/05/2003Sun 10/5 OPTION value=09/28/2003Sun 9/28 OPTION value=09/21/2003Sun 9/21 OPTION value=09/14/2003Sun 9/14 OPTION value=08/31/2003Sun 8/31 OPTION value=08/01/2003Fri 8/1 OPTION value=07/02/2003Wed 7/2 OPTION value=06/02/2003Mon 6/2 OPTION value=05/03/2003Sat 5/3 OPTION value=04/03/2003Thu 4/3 OPTION value=03/04/2003Tue 3/4 OPTION value=02/02/2003Sun 2/2 OPTION value=01/03/2003Fri 1/3 OPTION value=12/04/2002Wed 12/4 /SELECT -- I would like to know i can go about doing that. some examples, or if anyone has a function already the i could use. Thanks in advance,
[PHP-DB] weird php error
Hi guys, This is weird to me.. I got this script --- ?php if ($_GET[login] == 'forgot') { echo Sorry I forgot my password; } else { echo you are good to go; } ? - when ran, it gives me this error Notice: Use of undefined constant login - assumed 'login' in G:\Inetpub\wwwroot\test\index.php on line 3 Notice: Undefined index: login in G:\Inetpub\wwwroot\test\index.php on line 3 good to go What is this all about? The script look fine to me. Thanks in advance for your support
[PHP-DB] array issue
hi ya'll I am having a nightmare on this issue of mine. I've got this array that I need to write to a file... sample code below while (something); { query data base $r_ul=ifx_fetch_row($sideQuery4); $type1 = array($rotation.\n); switch ($r_ul['number']) { case '4'; $linea = $type1; break; } $final = $linea[0]; $my_array = array(); array_push ($my_array, $final); } $file = 'db_dump.dat'; $fp = fopen($file, w); fputs($fp, $my_array); --- I would like to write the complete array into the file fclose($fp); kindly assist with this issue.. Thanks in advance
Re: [PHP-DB] array issue
Hey guys thanks a lot your method worked perfect Aaron, thanks and that serialize() function, hummm i got to go do some reading and testing. thanks for enlightenment and the assistance guys. RedHat.OpenSource.bz - Original Message - From: Aaron Wolski [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: 'PHP-DB' [EMAIL PROTECTED]; 'OpenSource' [EMAIL PROTECTED] Sent: Sunday, August 17, 2003 10:04 AM Subject: RE: [PHP-DB] array issue Good point and nice find, Jeff! I wasn't sure where he was going with the data.. was he trying to save the actual array, intact, for say a chaching exercise or did he want to insert the contents of that array into a file? Could go either way I suppose :) Aaron P.S. Working on a Sunday too? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:48 AM To: Aaron Wolski Cc: 'PHP-DB'; 'OpenSource' Subject: RE: [PHP-DB] array issue This may or may not make sense for your issue. but if you have the whole array in memory you can serialize() it and write the string that the function returns to the file. $fp = fopen(yourfilename.txt, w); $my_array_s = serialize($my_array); if (isset($fp)) { fwrite($fp, $my_array_s); } //to get it back into the same array as it was written, use $fp_cache = fopen(yourfilename.txt, r) or die(can't open file); $fp_readc = fread($fp_cache, filesize(yourfilename.txt); $my_array_new = unserialize($fp_readc); the data is exactly as it was returned from the db after you looped through the record set. another idea. --http://www.php.net/manual/en/function.serialize.php hth jeff Aaron Wolski [EMAIL PROTECTED]To: 'OpenSource' [EMAIL PROTECTED], 'PHP-DB' [EMAIL PROTECTED] z.com cc: Subject: RE: [PHP-DB] array issue 08/17/2003 11:33 AM First, are you sure there is data in $my_array? Add this after you set the array: echo pre.print_r($my_array)./pre; You'll need to loop through the array , writing each line in the file at a time. Something like: //open the file stuff here foreach ($my_array AS $values) { fputs($fp, $value); } //close the file stuff here HTH Aaron -Original Message- From: OpenSource [mailto:[EMAIL PROTECTED] Sent: August 17, 2003 11:31 AM To: PHP-DB Subject: [PHP-DB] array issue Importance: High hi ya'll I am having a nightmare on this issue of mine. I've got this array that I need to write to a file... sample code below while (something); { query data base $r_ul=ifx_fetch_row($sideQuery4); $type1 = array($rotation.\n); switch ($r_ul['number']) { case '4'; $linea = $type1; break; } $final = $linea[0]; $my_array = array(); array_push ($my_array, $final); } $file = 'db_dump.dat'; $fp = fopen($file, w); fputs($fp, $my_array); --- I would like to write the complete array into the file fclose($fp); kindly assist with this issue.. Thanks in advance -- 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] sending data through FTP in PHP
Hey Guys, I need some assistance on this FTP stuff. I've got an array of data that I need to send via ftp to another server eg. $linea = array($sport.$rot1.$r_vl); This information is gotten from my database and needs to be sent to the other server every 5 seconds. I need to connect to the server then wait for a byte where 0 = valid and 1 = invalid than I am suppose to send the $linea info. can you give some pointers as to how I should go about doing this or if you guys has any pre-written functions that I can follow through. This is the first time I'm dealing with FTP in PHP.
Re: [PHP-DB] sending data through FTP in PHP
I'm given the IP and port to connect to. I will then send my username and password in this format: username|version\n password\ the version number is just 4 characters of the program eg. 1.00 I must then wait for a byte: '0' - valid '1' - invalid then I am to send the data as eg.L3200150.00 They should have another program on their end that will slurp up the data and do whatever with it. - Original Message - From: [EMAIL PROTECTED] To: OpenSource [EMAIL PROTECTED] Cc: PHP-DB [EMAIL PROTECTED] Sent: Monday, July 28, 2003 12:47 PM Subject: Re: [PHP-DB] sending data through FTP in PHP FTP is used to tranfer files, typically not an array of data.. Depending what you mean.. From the sounds of things you need a protocol gateway instead of using FTP.. Unless you are loading that array of data into a file on the remote server at which point something will slurp it up and wait for the next cycle.. There are lots of built in FTP functions in PHP that are easy to use.. make sure you compiled PHP with --enable-ftp .. On Mon, 28 Jul 2003, OpenSource wrote: Hey Guys, I need some assistance on this FTP stuff. I've got an array of data that I need to send via ftp to another server eg. $linea = array($sport.$rot1.$r_vl); This information is gotten from my database and needs to be sent to the other server every 5 seconds. I need to connect to the server then wait for a byte where 0 = valid and 1 = invalid than I am suppose to send the $linea info. can you give some pointers as to how I should go about doing this or if you guys has any pre-written functions that I can follow through. This is the first time I'm dealing with FTP in PHP. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php