Here's the deal. I'm a beginner in PHP, MySQL and HTML. I want to copy part of a database field and insert it into an html dinamic table (by dinamic I mean that the number of rows grows depending from the amount of rows in the database table). Let's say that I already limited the width of the cell in the html table in which I want to insert the data by a certain percentage of width. The problem lies in the copying. How can I copy the necessary amount of symbols so that it won't make my cell grow in height but stay only in a height equal to one line? Before copying, I want to ensure that there is "..." at the end of the line, right where I cut the text. One important detail. I'm working both with russian and english language here. My database fields that have text have "utf8-general-ci" collation. But I already use mysqli_set_charset and set cp1251 when ENTERING data into my database and mysqli_set_charset with utf8 when READING data from it.
Here is the php file where I am trying to read the data into the html table. Hope you can help me. Especially with the encoding problem. The current php file makes a � symbol at the end of the line, which is very troubling.
Hope you can help me.
<?php
include_once 'Connection.php';
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
table, th {
border: 1px solid black;
}
</style>
</head>
<body>
<h1 style="Text-align: center;">Существующие работы </h1><br><br><br>
<table style="width:100%">
<tr>
<th style="width:13%">Работодатель</th>
<th>Описание работы</th>
<th style="width:8%">Оплата</th>
<th style="width:8%">Количество людей</th>
<th style="width:10%">Срочность</th>
<th style="width:8%">Сложность</th>
</tr>
</table>
<?php
$sql = "SELECT * FROM request_data;";
$conn = Connect();
mysqli_set_charset($conn,'utf8');
$result = mysqli_query($conn, $sql);
$resultCheck = mysqli_num_rows($result);
if ($resultCheck > 0) {
while ($row = mysqli_fetch_assoc($result)) {
echo '<table style = "width:100%">
<tr>
<th style="width:13%">'.$row['ID'].'</th>
<th>'.substr($row['The_Job'],0,145).'...'.'</th>
<th style="width:8%">'.$row['Paymentfro'].'-'.$row['Paymentto'].'</th>
<th style="width:8%">'.$row['Amount'].'</th>
<th style="width:10%">'.$row['Urgency'].'</th>
<th style="width:8%">'.$row['Difficulty'].'</th>
</tr>
</table>';
}
}
?>
</body>
</html>