Converting to uppercase

This is a discussion on "Converting to uppercase" within the Databases section. This forum, and the thread "Converting to uppercase are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 29th, 2006, 09:40
Reputable Member
Join Date: Feb 2006
Location: London
Age: 26
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Converting to uppercase

Hi,

I'm trying to get the article_id field to be returned in uppercase...

Code: Select all
SELECT article_id, article_title, article_content FROM articles ORDER BY article_id DESC LIMIT 3
I thought this would work...

Code: Select all
SELECT article_id, UPPER ('article_title'), article_content FROM articles ORDER BY article_id DESC LIMIT 3
but no luck

Thanks for your help!
Jim.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old May 1st, 2006, 14:43
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Converting to uppercase

A little clarification required.

You start by saying you want the 'article_id' in uppercase but your code shows you using the 'UPPER' command on the 'article_title' field.

Also you have the 'article_title' inside quotes whereas what you want is just the field name, e.g.,

select article_id, upper(article_title)...

Last edited by ukgeoff; May 1st, 2006 at 14:46.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 1st, 2006, 23:15
Reputable Member
Join Date: Feb 2006
Location: London
Age: 26
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Re: Converting to uppercase

Hi ukgeoff,

Ah sorry, article_title is the field I want returned in uppercase.
If I write it with or without quotes, I get no error and no text is displayed
Code: Select all
 SELECT article_id, UPPER (article_title), article_content FROM articles ORDER BY article_id DESC LIMIT 3
I found a solution with css --- text-transform: uppercase;
But I would still like to know what I'm doing wrong...

Cheers,
Jim.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 2nd, 2006, 10:30
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Converting to uppercase

Hi Jim,

If you were showing error messages you should be seeing a syntax error.

SQL doesn't like the space between upper and the opening bracket, i.e., you need

upper(art... and not upper (art...

Kind Regards
Geoff
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old May 2nd, 2006, 12:35
Reputable Member
Join Date: Feb 2006
Location: London
Age: 26
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Re: Converting to uppercase

Thanks for your help, but it still dosen't work...

I turned on all error reporting in php.ini

I did a var_dump on the variable and it dumped out the string, but as soon as I put UPPER anywhere it says the variable is equal to NULL...

Tried a million different ways, and did it just like the mysql manual said...

Too hard basket...

Thanks anyway. I'll just use the CSS.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old May 2nd, 2006, 14:38
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Converting to uppercase

Ok. So assuming you got rid of the space, the syntax is now correct so its more of a puzzle.

I use a tool called SQLyog for setting up and managing my MySQL databases. It's absolutely superb.

I use a paid for version but they do a free version as well.

http://www.webyog.com/

Give it a try. it might give you more of an insite into what is going on and what your database actually looks like.

You can at least satisfy yourself that there is nothing wrong with the syntax which may help point you in the right direction.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old May 2nd, 2006, 21:50
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Converting to uppercase

Why dont you just use:
PHP: Select all

$string  "hello my friend";
strtoupper($string);
echo 
$string

Would make HELLO MY FRIEND
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
converting, uppercase

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting this to css..... jahphill Web Page Design 3 Jun 9th, 2008 11:19
Converting UTF-8 characters to ISO darkling235 JavaScript Forum 2 Mar 23rd, 2008 22:40
converting an swf into an fla danny322 Flash & Multimedia Forum 5 Feb 2nd, 2008 08:32
converting to css sliz Web Page Design 5 Aug 28th, 2007 14:30
Converting Time Michaeln Databases 1 Jun 3rd, 2007 13:34


All times are GMT. The time now is 16:00.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42