- 1
- 2
- 3
- 4
- 5
- 6
- 7
$s = $_REQUEST['user_str'];
$lnk = mysqli_connect('localhost','root','1234','Jelwery') or die("Error ".mysqli_error($connection));
mysqli_set_charset("utf8");
$res = mysqli_query($lnk, "SELECT SUBSTRING('".$s."',1,8') as result") or $res = ("Ошибка ".mysqli_error($connection));
$row = mysqli_fetch_assoc($res);
$s = $row['t'];
echo 'Truncated string: '.$s;