Select images from the sqlserver php database

-1

I have a query that selects information from the database but I can not print the images on the screen, the address of the images folder are in

\192.168.10.129\sapshared\FOTOS\KennedyDB

but the application is running from 192.168.10.134 , here I leave my code:

<html>
<head>
<title>Prueba de PHP</title>
 </head>
 <body>


<?php
$serverName = "192.168.10.134";
$connectionInfo = array( "Database"=>"**********", "UID"=>"**", "PWD"=>"***");
$conn = sqlsrv_connect( $serverName, $connectionInfo);

$sql = "SELECT TOP 200 Itemcode, Itemname, PicturName FROM OITM ";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
echo "<table border = '1' class = 'table0' > \n"; 

echo "<tr><td>Itemcode</td><td>Itemname</td><td>Picture</td></tr> \n";
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
    echo "<tr><td>$row[Itemcode]</td><td>$row[Itemname]</td><td>$row[PicturName] </td></tr> \n"; 
}
echo "</table> \n"; 


sqlsrv_free_stmt( $stmt);
?>


 </body>
</html>

As it is, in the field picturname only shows the name of the image eg. image.jpg

    
asked by Leonardo Rodríguez 08.05.2018 в 16:33
source

1 answer

0
<td><img src='\192.168.10.129\sapshared\FOTOS\KennedyDB' alt='$row[PicturName]'> </td>

Maybe you \ 'll have to duplicate them, and put \\\\ in front of the ip, and the rest of simple contrabarras duplicate them too \\

You also have to check that the php server has access to that local route and to the specific folder so that it can show the img.

    
answered by 08.05.2018 в 17:01