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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting one value in array to UPPER case

Status
Not open for further replies.

sharapov

MIS
Joined
May 28, 2002
Messages
106
Location
US
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:
     $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=&quot;&quot;;
            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]).&quot;,&quot;; 
                }
                $fval = $mval;
            }
        }else{
		    $fval = AddSlashes($array[$x]); 
        }
		$qry .= &quot;'$fval'&quot;; 
		if ($x < $flds-1){ 
			$qry.= &quot;, &quot;; 
		} 
	} 
	$query .= $qry.&quot;)&quot;; 

	$result=exequery($query, $tablename, $dbname); 
	if($result){ 
		return $result; 
	}else{ 
		return false; 
	}
 
sleipnir214,

I understand the concept. What I can't figure out where to plug it in inside my code. Can you help?

Thanks.
 
Thanks for the tip. I figured it out!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top