note 54554 deleted from function.strtoupper by mazzanet

From: Date: Fri, 08 Jul 2005 07:22:28 +0000
Subject: note 54554 deleted from function.strtoupper by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-91638@lists.php.net to get a copy of this message
Note Submitter: jeremy at opendoorvisions dot com ---- created this to convert a clients inventory system to all uppercase when the db was already created. <?php /* Author: Jeremy Hoffman: Opendoor Visions www.opendoorvisions.com June 2005 */ //this require is the connection to your database require("connectdb.inc"); // check for connection --------------- if(!$db){ echo 'Cannot Connect To Database'; } else{ mysql_select_db('databasename',$db); } query = 'SELECT * FROM customers'; $result = mysql_query($query); $num_results = mysql_num_rows($result); for($j = 0; $j < $num_results; $j++){ // replace the names next to description with your database headings $description = mysql_fetch_array($result); $firstname = $description['customers_firstname']; $lastname = $description['customers_lastname']; $id = $description['customers_id']; // Convert the strings to Uppercase $firstname = strtoupper($firstname); $lastname = strtoupper($lastname); // change the DB! $query='UPDATE customers SET customers_lastname="'.$lastname.'", customers_firstname="'.$firstname.'" WHERE customers_id="'.$id.'"'; mysql_query($query); } ?>

« previous php.notes (#91638) next »