I am trying to format the month portion of a date that I am trying to
pull from MySQL to be placed into a drop down menu to modify the date.
I have tried several ways and none seem to be working. =20
I am pulling the date out of MySQL with:=20
$sDate =3D explode("-", $row_events['Sdate']);
And then attempting to insert each portion of the array into a drop down
menu with:
echo "
Re: Date Formatting Question
am 14.12.2005 15:52:31 von El Bekko
Bomgardner, Mark A wrote:
> I am trying to format the month portion of a date that I am trying to
> pull from MySQL to be placed into a drop down menu to modify the date.
> I have tried several ways and none seem to be working.
>
> I am pulling the date out of MySQL with:
> $sDate = explode("-", $row_events['Sdate']);
>
> And then attempting to insert each portion of the array into a drop down
> menu with:
> echo "
Re: Date Formatting Question
am 14.12.2005 17:18:03 von Trevor Gryffyn
You got the right idea, but you're making it more complicated than it needs to be.
your $sDate after using explode() is going to contain an array. strtotime doesn't take an array, it takes a string.
$monthName = date("F", strtotime($row_events['Sdate']));
$monthNumber = date("m", strtotime($row_events['Sdate']));
// or "n" if you want "1" instead of "01" for January
I am trying to format the month portion of a date that I am trying to
pull from MySQL to be placed into a drop down menu to modify the date.
I have tried several ways and none seem to be working.
I am pulling the date out of MySQL with:
$sDate = explode("-", $row_events['Sdate']);
And then attempting to insert each portion of the array into a drop down
menu with:
echo "";
echo "";
which is where I am running into the problem. I pull out the month as 2
digit numeric 01, 02, 03 etc., but I want it displayed as January,
February, March, etc.,
Apart from anything, you need to supply an option value for each of
those options, not just rely on the browser which will default to
passing the option *text* back from the form, if you specify no
value. So your option elements should read
Notwithstanding that, RE below - you guys are all nuts, this is a
ridiculous way to do it.
Let MySQL do the work, it has perfectly good functions to do this :
SELECT DATE_FORMAT(date_field_name, '%c') AS intDate,
DATE_FORMAT(date_field_name, '%M'') AS strMonth
FROM yadda etc etc
Then you use (assuming your're using $result = mysql_fetch_assoc()
as your looped result variable name)
while ($result = mysql_fetch_assoc($link)) {
$optionlist.="
if ($selected_month==$result['intDate']) {
$optionlist.=' selected="selected"';
}
$optionlist.='"'.$result['intDate'].'">'.$result['strMonth'] ."'\r\n\t";
} // End while
print($optionlist);
HTH
Cheers, Neil
>To: php-db@lists.php.net
>Date: Wed, 14 Dec 2005 15:52:31 +0100
>From: El Bekko
>Reply-To: elbekko@gmail.com
>Subject: Re: Date Formatting Question
>
>Bomgardner, Mark A wrote:
>I am trying to format the month portion of a date that I am trying to
>pull from MySQL to be placed into a drop down menu to modify the date.
>...snip...
>modify and it would be easier to do it in PHP
>Any pointers would be appreciated.
>
>Mark Bomgardner
>Technology Specialist
>KLETC
>
>make a function like this:
>
>function datenum2str($date)
> {
> $newdate = str_replace("01","Jan",$date);
> $newdate = str_replace("02","Feb",$date);
> $newdate = str_replace("03","Mar",$date);
> $newdate = str_replace("04","Apr",$date);
> $newdate = str_replace("05","May",$date);
> $newdate = str_replace("06","Jun",$date);
> $newdate = str_replace("07","Jul",$date);
> $newdate = str_replace("08","Aug",$date);
> $newdate = str_replace("09","Sep",$date);
> $newdate = str_replace("10","Oct",$date);
> $newdate = str_replace("11","Nov",$date);
> $newdate = str_replace("12","Dec",$date);
>
> return $newdate;
> }
>
>And then use this:
>
>echo "";
>echo "";
>
>
>Hope it helps,
>
>El Bekko
Im using PHP and MySQL
I try to import txt file to mysql Database
But file size bigger than 2048KB so I could not import it
It is related with range_alloc_block_size
Because in mysql this veriable is 2048.
If it is possible how can I change this variable.
Please If somebody knows this help me..
Thank you...
Murat
______________________________________
XamimeLT - installed on mailserver for domain @deprem.gov.tr
Queries to: postmaster@deprem.gov.tr
______________________________________
The views and opinions expressed in this e-mail message are the sender's own
and do not necessarily represent the views and the opinions of Earthquake Research Dept.
of General Directorate of Disaster Affairs.
Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olarak T.C.
B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikte degildir.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
This could be a number of things. Are you uploading the file in the script?
Then the max_upload_size may have been exceeded. If not, then it could be
the memory_limit, or the max_execution_time. Check your httpd/php error log
(commonly at: /var/log/httpd/error_log) and adjust the referenced variables
in the PHP ini value or using ini_set().
Read this post also:
http://aspn.activestate.com/ASPN/Mail/Message/php-db/2931073
I can't imagine this is a DB problem.
Aaron
On 12/16/05, Murat Beyhan wrote:
>
> Hello,
>
> Im using PHP and MySQL
> I try to import txt file to mysql Database
> But file size bigger than 2048KB so I could not import it
> It is related with range_alloc_block_size
> Because in mysql this veriable is 2048.
> If it is possible how can I change this variable.
> Please If somebody knows this help me..
> Thank you...
> Murat
>
>
> ______________________________________
> XamimeLT - installed on mailserver for domain @deprem.gov.tr
> Queries to: postmaster@deprem.gov.tr
> ______________________________________
> The views and opinions expressed in this e-mail message are the sender's
> own
> and do not necessarily represent the views and the opinions of Earthquake
> Research Dept.
> of General Directorate of Disaster Affairs.
>
> Bu e-postadaki fikir ve gorusler gonderenin sahsina ait olup, yasal olara=
k
> T.C.
> B.I.B. Afet Isleri Gn.Mud. Deprem Arastirma Dairesi'ni baglayici nitelikt=
e
> degildir.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
------=_Part_6227_21763044.1134728657030--
Re: range_alloc_block_size
am 16.12.2005 11:38:31 von robleyd
> On 12/16/05, Murat Beyhan wrote:
>>
>> Hello,
>>
>> Im using PHP and MySQL
>> I try to import txt file to mysql Database
>> But file size bigger than 2048KB so I could not import it
>> It is related with range_alloc_block_size
>> Because in mysql this veriable is 2048.
>> If it is possible how can I change this variable.
>> Please If somebody knows this help me..
>> Thank you...
>> Murat
Aaron Koning wrote:
> This could be a number of things. Are you uploading the file in the
> script? Then the max_upload_size may have been exceeded. If not, then it
> could be the memory_limit, or the max_execution_time. Check your httpd/php
> error log (commonly at: /var/log/httpd/error_log) and adjust the
> referenced variables in the PHP ini value or using ini_set().
>
> Read this post also:
> http://aspn.activestate.com/ASPN/Mail/Message/php-db/2931073
>
> I can't imagine this is a DB problem.
>
> Aaron
It might well be. There is a config setting in mysql called
max_allowed_packet which might be relevant in this case. IIRC it defaults
to quite a small value. Yes, the default is 1 Mb in versions 3 and 4 of
mysql.
Cheers
--
David Robley
"I joined the Lion's Club," said Tom pridefully.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php