I have the need to get the first word of a data from the table. I have searched for information but I only see to get the characters you want.
<?php
$usuario = $_SESSION['username'];
$pass = $_SESSION['password'];
$results = $mysqli->query("SELECT Nombre, SUBSTRING(Nombre, 1,20) AS palabra,
IdUsuario, Username, Password
FROM Usuarios
WHERE Username='$usuario' AND Password ='$pass'");
mysqli_set_charset("utf8");
if($res = $results->fetch_array()) {}
?>
For example, in the Nombre
column, the record contains Nombre Apellido 2Apellido
. I need to extract the Nombre
.