Author Topic: reducing echo value  (Read 126 times)

0 Members and 1 Guest are viewing this topic.

Offline jacko_162Topic starter

  • Enthusiast
  • Gender: Male
    • View Profile
    • Real-Creative.co.uk
reducing echo value
« on: March 13, 2010, 06:47:53 PM »
when i echo my results (months) i use;

$month

this displays the month in full how can i limit this to show;

"Dec" instead of "December" without changing my database :)

this is the full echo code im using;

       // make sure we have a valid product
       
if($id != "" && $id != null)
          echo 
"<td width='120' height='115' background='img/calendars/blank_calendar.png'><a href='testresults.php'><div class='cal_text' align='center'><strong><img src='img/spacer.png' width='1' height='6'><br>
      
$id<br>$month</strong></div></a>";


it displays the date as:

16
December

i want it to display;

16
Dec

many thanks :)
i love the phpfreaks :)

Offline Tazerenix

  • Enthusiast
  • Gender: Male
  • Call me taz :D
    • View Profile
    • Tazerenix Productions
Re: reducing echo value
« Reply #1 on: March 13, 2010, 07:05:40 PM »
how are you entering it into the database
Quote
"War does not determine who is right... Only who is dead" - Unknown




NOTE: Most of the code I post is untested. So hope for the best

Offline jacko_162Topic starter

  • Enthusiast
  • Gender: Male
    • View Profile
    • Real-Creative.co.uk
Re: reducing echo value
« Reply #2 on: March 13, 2010, 07:21:55 PM »
the month gets entered as a full month name "December" as i call it on another page. its done automatically in a hidden txt box in a user submitted form.
i love the phpfreaks :)

Offline teamatomic

  • Devotee
  • Gender: Male
  • fat skis rule!
    • View Profile
    • myPHPtemplate
Re: reducing echo value
« Reply #3 on: March 13, 2010, 07:57:16 PM »
$month=substr($month,0,3);

HTH
Teamatomic
when in doubt...ski fast
when scared...ski faster
when terrified...point em down

Online thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
    • View Profile
Re: reducing echo value
« Reply #4 on: March 13, 2010, 08:01:31 PM »
echo date('M'strtotime($month));

Offline jacko_162Topic starter

  • Enthusiast
  • Gender: Male
    • View Profile
    • Real-Creative.co.uk
Re: reducing echo value
« Reply #5 on: March 13, 2010, 08:07:02 PM »
$month=substr($month,0,3);

HTH
Teamatomic


worked a treat :)
i love the phpfreaks :)

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.