I have a database with a lot of records that I need in lowercase. They are now all in uppercase. I have written the code to do the update, but am getting an error. Here is the code:
$link = mysql_connect("localhost","root","") or die(mysqsl_error());
mysql_select_db("xs") or die(mysql_error());
$query = "SELECT city FROM testupper";
$result = mysql_query($query, $link) or die(mysql_error());
$num_cities = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$str = $row['city'];
$str = strtolower($str);
$str = ucwords($str);
echo $str."<br />";
$update = "UPDATE testupper SET city = ".$str;
$results = mysql_query($update) or die(mysql_error());
}
Is there a problem with my update string? Thanks for any ideas!