Jump to content

Is there a way to change all of my values within a mysql table to proper case?


wright67uk

Recommended Posts

Is there a way to change all of my values within a mysql table to proper case?

 

At the moment I have some values as upper and others as lower.

I have mysql admin.

 

Is this possible, or would it be easier to transfer my data into excel for processing?

 

Link to comment
Share on other sites

Thankyou, that is great to know.  I do need to change the values to First Letter Capitals but I wasn't too sure if it was possible within mysql.

 

<?php
$subtype = $_GET['subtype'];

echo "<h1>$subtype</h1>";
$query = "SELECT name, phone, email, WebAddress, postcode FROM business WHERE subtype ='$subtype' AND confirmed ='Yes' ORDER BY name";
if( $result = mysql_query($query) ) {
echo mysql_error();
while($row = mysql_fetch_assoc($result) ) {
	foreach( $row as $k => $v ) {
		if( empty($v) ) {
			unset($row[$k]);
		}
	}
	if( !empty($row['postcode']) ) {
		$row['postcode_link'] = "<p class=link><a href='/gmap.php?postcode=" . urlencode($row['postcode']) . "'>Map</a></p><br>";
	}
	echo implode( '<br>', $row);
}
}
?>

 

The results in the query above would be using the first letter capitals. 

Im not bothered if this is stored in mysql or wether it is just formartted in php, just a bit gazumped when it comes to doing it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.