Re: [PHP-DB] SELECT date query

2006-10-07 Thread Hodicska Gergely

Hi!


You can make this easier with date('w').
 $correction = array(3, 2, 1, 7, 6, 5, 4);
 list($year, $month, $day, $dayOfWeek) = explode('|', date('Y|m|d|w'));
 echo date (Y.m.d, mktime 
(0,0,0,$month,$day+$correction[$dayOfWeek],$year));



Regards,
Felhő


Niel Archer wrote:

Hi Ron

I've made the assumption that if today is Wednesday, you still want next
Wednesday.
Try this:

$offset = array(3,2,1,7,6,5,4);
$date = explode(-, date(Y-n-j));
$ToDay = DayOfWeek($date[0], $date[1], $date[2]);
$NextWed = date(Y-n-j, time() + ($offset[$ToDay] * 24 * 60 * 60));

// Returns a digit in range 0-6. 0 = Sunday, 6 = Saturday
function DayOfWeek($Year, $Month, $Day)
{
$t = array(0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4);
$Year -= $Month  3;
return ($Year + ($Year / 4) - ($Year / 100) + ($Year / 400) +
$t[$Month - 1] + $Day) % 7;
}


Niel



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] SELECT date query

2006-10-07 Thread Niel Archer
Hi

 You can make this easier with date('w').

Doh, that'll teach me to code at 5 am.  I knew there was a better way,
but couldn't think of it, the sound of my bed calling was too
distracting.

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Files uploaded through a form

2006-10-07 Thread Ron Piggott (PHP)
The way my web hosting server was configured is that files uploaded
through a web form to be processed by PHP are owned by 'www'.  I am
wondering if I am able to change the owner of the file to my ftp user
name before I use the move_uploaded_file command to the directory I need
the file to move to.  

I am also wondering what the IF syntax is to see if the file upload was
successful.  Somehow I would like to know if 

move_uploaded_file( $userfile , $destination_file_name);

worked successfully before I update my table.

Ron


[PHP-DB] ECHO $variable

2006-10-07 Thread Ron Piggott (PHP)
In one of my scripts I have

input type=text name=message_title size=40 maxlength=80 value=?echo
$saved_message_title;?

where

$saved_message_title is 1 Peter 5:7 Cast all your cares on Him for He
cares about you
--- note the  

When this is displayed on the screen it reads

1 Peter 5:7 

I am assuming the  closes the value=

How may I echo this to the screen and have the full text be displayed,
not just 1 Peter 5:7 ?

Ron


Re: [PHP-DB] ECHO $variable

2006-10-07 Thread Niel Archer
Hi

Where's the DB question?

Niel

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php