Good morning,
It turns out that in a .php file I receive a request through ajax and then fill a table in another file with the records found according to the parameter, everything works great. First of all, this is important, my .php file which makes the query and fills the table is a fixed route, for example: misitio.com/consultas/consultar_datos.php
In a field of the query I have the path of a photo that the user previously uploaded by means of another script, which has been, for example: misitio.com/uploads/foto13.jpg
What I want is that when I fill in the table, as I say, everything works correctly, when I put the link in the cell, I can place a label that says see a photo and so I open the image, the problem is that the link is as follows: misitio.com/consultas/misitio.com/uploads/foto13.jpg
ie, it takes the folder in which the .php file is, and it concatenates it with the link that is in the mysql field: misitio.com/consultas + misitio.com/uploads/foto13.jpg
here the code of the complete php file:
<?php
include '../PHP/conectar.php';
//hago la consulta
$result = mysqli_query($conexion,"select * from solicitudes WHERE estado='Solicitado' and tipo_solicitud='revision_tecnica'");
echo "<table>
<tr>
<th align='center'>Nombre</th>
<th align='center'>Comentarios</th>
<th align='center'>Foto</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td align='center'>" . $row['nombre'] . "</td>";
echo "<td align='center'>".$row['comentarios']."</td>";
//aqui es donde esta mal
$ruta=$row['ruta_foto'];
echo "<td align='center'><a href='$ruta'>Ver foto</a></td>";
//ya he intentado asi
//echo "<td align='center'><a href='".$ruta."'>Ver foto</a></td>";
//tambien intenté asi, sin guardar en variable
//echo "<td align='center'><a href='$row['ruta_foto']'>Ver foto</a></td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($conexion);
?>
if you are wondering, I already checked that in mySql if the link is saved well, that is% misitio.com/uploads/foto13.jpg
for the example
Any ideas?
Thank you!