Re: echo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



something like this : Inetpub\wwwroot\album\img
as I am running out of time! could someone complete this code just with one echo and img src so that I can retrive my photos ?

MySQL columns : photoID=seq number
                                        photoFileName=name of my photo like 3sw.jpg
                                 title=title
                                 description=short description


<?php

$link = mysql_connect('localhost', 'root', 'pw');
if (!$link) {
    die('Not connected : ' . mysql_error());
}

$db_selected = mysql_select_db('album', $link);

$query = "SELECT * FROM photo";
$result=mysql_query($query);

while ($row = mysql_fetch_array($result))
{
////echo???

}

mysql_free_result($result);

?>


The path would be relative to your web root folder.

in your case
<img src="/album/img/image_name">

or if you are testing on your own machine use
<img src="http://localhost/album/img/image_name";>
or if you need it to work for outside connections :
<img src="http://your_ip_addres/album/img/image_name";>

i suggest using the relative path.

while ($row = mysql_fetch_array($result)) {
 echo "<img src='/album/img/".$row["photoFileName"]."' />
}

P.S.

Chris sorry for accidentaly sending it only to you the first time..

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux