Hello friends! I have a problem and it is the following:
I have a Token of this magnitude:
0df784678f277798b5752efcc4c7292b
But I want it to be like this:
7292b
Thanks in advance for your answers.
This is my PHP code:
<?php
$idUsuario = $_SESSION['id_usuario'];
$resultados = mysqli_query($mysqli,"SELECT token FROM usuarios WHERE id = $idUsuario");
while($consul = mysqli_fetch_array($resultados)){
echo $consul['token'];}
?>
Use the function
SUBSTRING()
which requires:Query:
Resulting:
you can change your query a bit to get the last 5 characters of your token column:
RIGHT is a method that asks for two arguments: the column to get the value from, and a number that tells it how many characters from the left to retrieve. a greeting! :D