Re: Making several variables into 1 variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 28, 2009 at 10:40 AM, Miller,
Terion<tmiller@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>
>
> <,snip>
>>
>
> You can also do this right within MySQL without needing to create a
> variable.  This should work:
> $sql = "SELECT DISTINCT restaurants.ID, name, address, inDate FROM
> restaurants, inspections WHERE restaurants.name != '' AND
> datediff(curdate(),inspections.inDate)>=30 GROUP BY restaurants.ID
> ORDER BY 'name' ";
>
> Take care,
> Floyd
>
>
>
> Ok I have to do the same thing again but with even more variables posted from a form
> I have a form where a user can choose a date range currently the form returns 6 variables (bmonth, bday, byear, emonth, eday, eyear) now I have to take those and get them all formatted together (well the bmonth, bday, byear together) in the mm/dd/yy format
>
> Wait can't I.....
> $month = $date(m, $bmonth) like that but then I still end up with 3
>
> $month, $day, $year.... Does that work like that $date(m/d/y, $month, $day, $year)
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Use strtotime to convert a text string into a time value that php can
then use to figure out a date.

$date = date('m/d/y', strtotime("$month/$day/$year");

-- 

Bastien

Cat, the other other white meat

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux