Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Break Apart Text 2

Status
Not open for further replies.

dagger2002

Programmer
Nov 23, 2004
172
US
ok i have a question.

How do i break apart text.

I have a 4 digit code (YYMM) and want to be able to display it as

0601 = January 2006
0602 = February 2006

and so on.

What do i use to do this?

Thanks alot in advanced
 
would you not get the result you are looking for by changing your query?

Code:
$queryRt ="		
			SELECT DISTINCT 
				sto_date 
			FROM `stories` 
			WHERE 
				`sto_artType` = '3' 
			AND 
				`newsIss` != " . $rowMain['newsIss'] . " 
			AND `
				sto_include` = '1' 
			LIMIT 0 , 30";
 
Im trying to sort by iss, which stands for issues, its just not playing nice. and i need more then just the date unfortunately.
 
why? why not just add the order by clause?

anyway the reason why distinct is not working for you is that you are including the primary key (and perhaps other row-unique data) and so there will never be two rows that are equal.

so you may be able to achieve the DISTINCT(ion) [sorry] you want by limiting the columns that you ask for in the Select clause (which is best practice anyway)
 
Tahnk you jpadie and sleipnir for all of the help. I now have the distinct working correctly. This also fixes another problem that i had posted a month ago in the mysql forum.

Thank you both.

I have given u both a star for the help.

Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top