Hello! There is a line:

<TD align="CENTER" ><a href="http://test.ru/'.$result_query["type_tovara"].'/'.$result_query["products_id"].'-'.$result_query["title"].'">...</a> </TD> 

As a result, the following link opens (for example):

http://test.ru/tshirts/3-Test/

The name Test is taken from the database, I need to make it so that Test is not written with a capital letter, how can I implement it? Writing in bd with a small letter is not an option.

Full page php:

 <?php session_start(); if ($_SESSION['auth_admin'] == "yes_auth") { define('myeshop', true); if (isset($_GET["logout"])) { unset($_SESSION['auth_admin']); header("Location: login.php"); } $_SESSION['urlpage'] = "<a href='index.php' >Главная</a> \ <a href='view_order.php' >Просмотр заказов</a>"; include("include/db_connect.php"); include("include/functions.php"); $id = clear_string($_GET["id"]); $action = $_GET["action"]; if (isset($action)) { switch ($action) { case 'accept': if ($_SESSION['accept_orders'] == '1') { $update = mysql_query("UPDATE orders SET order_confirmed='yes' WHERE order_id = '$id'",$link); }else { $msgerror = 'У вас нет прав на подтверждение заказов!'; } break; case 'delete': if ($_SESSION['delete_orders'] == '1') { $delete = mysql_query("DELETE FROM orders WHERE order_id = '$id'",$link); header("Location: orders.php"); }else { $msgerror = 'У вас нет прав на удаление заказов!'; } break; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link href="css/reset.css" rel="stylesheet" type="text/css" /> <link href="css/style.css" rel="stylesheet" type="text/css" /> <link href="jquery_confirm/jquery_confirm.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script> <script type="text/javascript" src="js/script.js"></script> <script type="text/javascript" src="jquery_confirm/jquery_confirm.js"></script> <title>Панель Управления - Просмотр заказов</title> </head> <body> <div id="block-body"> <?php include("include/block-header.php"); ?> <div id="block-content"> <div id="block-parameters"> <p id="title-page" >Просмотр заказа</p> </div> <?php if (isset($msgerror)) echo '<p id="form-error" align="center">'.$msgerror.'</p>'; if ($_SESSION['view_orders'] == '1') { $result = mysql_query("SELECT * FROM orders WHERE order_id = '$id'",$link); If (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result); do { if ($row["order_confirmed"] == 'yes') { $status = '<span class="green">Обработан</span>'; } else { $status = '<span class="red">Не обработан</span>'; } echo ' <p class="view-order-link" ><a class="green" href="view_order.php?id='.$row["order_id"].'&action=accept" >Подтвердить заказ</a> | <a class="delete" rel="view_order.php?id='.$row["order_id"].'&action=delete" >Удалить заказ</a></p> <p class="order-datetime" >'.$row["order_datetime"].'</p> <p class="order-number" >Заказ № '.$row["order_id"].' - '.$status.'</p> <TABLE align="center" CELLPADDING="10" WIDTH="100%"> <TR> <TH>№</TH> <TH>Наименование товара</TH> <TH>ID товара</TH> <TH>Фото</TH> <TH>Цена</TH> <TH>Количество</TH> <TH>Размер</TH> </TR> '; $query_product = mysql_query("SELECT * FROM buy_products,table_products WHERE buy_products.buy_id_order = '$id' AND table_products.products_id = buy_products.buy_id_product",$link); $result_query = mysql_fetch_array($query_product); do { $price = $price + ($result_query["price"] * $result_query["buy_count_product"]); $index_count = $index_count + 1; echo ' <TR> <TD align="CENTER" >'.$index_count.'</TD> <TD align="CENTER" ><a href="http://test.ru/'.$result_query["type_tovara"].'/'.$result_query["products_id"].'-'.$result_query["title"].'">'.$result_query["title"].'</a> </TD> <TD align="CENTER" >'.$result_query["products_id"].'</TD> <TD align="CENTER" ><img src="http://test.ru/uploads_images/'.$result_query["image"].'" width="50" height="50"></TD> <TD align="CENTER" >'.$result_query["price"].' грн</TD> <TD align="CENTER" >'.$result_query["buy_count_product"].'</TD> <TD align="CENTER" >'.$result_query["buy_cart_size"].'</TD> </TR> '; } while ($result_query = mysql_fetch_array($query_product)); if ($row["order_pay"] == "accepted") { $statpay = '<span class="green">Оплачено</span>'; }else { $statpay = '<span class="red">Не оплачено</span>'; } echo ' </TABLE> <ul id="info-order"> <li>Общая цена - <span>'.$price.'</span> грн</li> <li>Способ доставки - <span>'.$row["order_delivery_method"].'</span></li> <li>Статус заказа - '.$statpay.'</li> <li>Дата заказа- <span>'.$row["order_datetime"].'</span></li> </ul> <TABLE align="center" CELLPADDING="10" WIDTH="100%"> <TR> <TH>ФИО</TH> <TH>Город</TH> <TH>Отделение</TH> <TH>Моб. номер</TH> </TR> <TR> <TD align="CENTER" >'.$row["order_fio"].'</TD> <TD align="CENTER" >'.$row["order_city"].'</TD> <TD align="CENTER" >'.$row["order_number_np"].'</TD> <TD align="CENTER" >'.$row["order_phone"].'</TD> </TR> </TABLE> '; } while ($row = mysql_fetch_array($result)); } }else { echo '<p id="form-error" align="center">У вас нет прав на просмотр данного раздела!</p>'; } ?> </div> </div> </body> </html> <?php }else { header("Location: login.php"); } ?> 

  • strtolower ($ result_query ["title"]) - Daniel Protopopov
  • @DanielProtopopov 'strtolower ($ result_query ["title"])' - the page stopped altogether - Roman Shelest
  • @RTK 'lcfirst ($ result_query ["title"])' - the page also stops opening - Roman Shelest

2 answers 2

For multibyte encodings (for example, if you end up with a name in Russian), use:

 mb_strtolower($result_query["title"], 'UTF-8'); 

UPDATE 1

To get started, try after this line to add what you indicated above:

 $result_query = mysql_fetch_array($query_product); $result_query["title"] = mb_strtolower($result_query["title"], 'UTF-8'); 

Another embarrassing encoding in which you see the page itself:

 charset=iso-8859-1 

Try specifying the more common windows-1251 or better yet utf-8.

UPDATE 2

Change this section here:

 $result_query = mysql_fetch_array($query_product); do { $price = $price + ($result_query["price"] * $result_query["buy_count_product"]); 

on that:

 $result_query = mysql_fetch_array($query_product); $result_query["title"] = mb_strtolower($result_query["title"], 'UTF-8'); do { $price = $price + ($result_query["price"] * $result_query["buy_count_product"]); 
  • Something I can not do everything right: 'mb_strtolower ($ result_query ["title"],' UTF-8 ')' - the page does not work. My name is in English. - Roman Shelest
  • @ RomanShelest in what format do you receive data from the database? what encoding? and how do you handle them before output? Complete the question with the data output code from the database so that you can say more specifically. - Dmitry Maslennikov
  • Honestly - no idea in what format the data comes from the database. I attached the whole page for what exactly you need to show, unfortunately, I do not understand. - Roman Shelest
  • @ RomanShelest added his answer - Dmitry Maslennikov
  • I insert $ result_query ["title"] = mb_strtolower ($ result_query ["title"], 'UTF-8'); but does not open the page. Where should you insert $ result_query = mysql_fetch_array ($ query_product) ;? - Roman Shelest
 $newNameTov = mb_strtolower($result_query["title"], 'UTF-8'); <TD align="CENTER" ><a href="http://test.ru/'.$result_query["type_tovara"].'/'.$result_query["products_id"].'-'.$newNameTov.'">...</a> </TD> 
  • Using your example opens like this: test.ru/tshirts/3- That is, the "test" does not finish writing - Roman Shelest
  • $ result_query ["title"] do not receive. sure that the $newNameTov variable is output before the product link is $newNameTov , and after you receive the data of $result_query ? - iKey
  • @ Roman Shelest changed. try this - iKey
  • does not show further "test" ... - Roman Shelest
  • @ RomanShelest in what encoding is the file saved? and what encoding when connecting to the database? - iKey