Converting one value in array to UPPER case

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sharapov
Forum Newbie
Posts: 3
Joined: Tue Oct 28, 2003 11:11 pm

Converting one value in array to UPPER case

Post by sharapov »

I am collecting data from the form. Before I put collected data That I got from $_POST['array']) into a MySQL database I want to convert one of the values (let's say value 1 in the array) in the array to upper case. How can it be done?

Below is the snippet of my code that I use to put data into a dtabase.

Code: Select all

<?php
     $result=exequery("Select * from $tablename", $tablename, $dbname);
	 
	$flds = mysql_num_fields($result); 
	$qry=" "; 
    $query = "Insert into $tablename Values( "; 
	for ($x =0; $x < $flds; $x++){
	 	
            if(is_array($array[$x])){
            $mval="";
            for($m=0; $m < count($array[$x]); $m++){
                if($m+1 == count($array[$x])){
                    $mval.= AddSlashes($array[$x][$m]); 
               
                }else{
                    $mval.= AddSlashes($array[$x][$m]).","; 
                }
                $fval = $mval;
            }
        }else{
		    $fval = AddSlashes($array[$x]); 
        }
		$qry .= "'$fval'"; 
		if ($x < $flds-1){ 
			$qry.= ", "; 
		} 
	} 
	$query .= $qry.")"; 

	$result=exequery($query, $tablename, $dbname); 
	if($result){ 
		return $result; 
	}else{ 
		return false; 
	}
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Could you note where in your code you would like the strtoupper() to be placed?
Image Image
Post Reply