Jump to content

Image list download code needs fix.


artworthy

Recommended Posts

I'm trying to create a series of images on a page but the code won't run. (left table code out):

 

<body>

<?PHP

 

/// fyi, the image_link field contains, e.g., artistfoldername/imagefilename.jpg

 

$path = "artWorkImages/";

$art_id ='2';

 

    $QUERY="SELECT art_title, about_art, image_link FROM artWork WHERE art_id = '$art_id'";

    $res = mysql_query($QUERY);

$num = mysql_num_rows($res);

if($num>0){

 

while($row = mysql_fetch_array($res)){

$artist_name = $row["art_title"];

$about_art = $row["about_art"];

      $image_link = $row["image_link"];

 

print "<img src=$path.$image_link/>";

 

}

}

 

?>

</body>

 

Thanks

Allen

 

 

Link to comment
https://forums.phpfreaks.com/topic/214826-image-list-download-code-needs-fix/
Share on other sites

Thanks for replying -- though it didn't work.

FYI - the page does give me 1 text row of art_title (instead of 3) when it simply reads:

 

while($row = mysql_fetch_array($res)){

$art_title = $row["art_title"];

$about_art = $row["about_art"];

      $image_link = $row["image_link"];

 

echo $art_title;

 

thoughts

 

Didn't have glasses on (Old man excuse)

 

Not sure if single vs double may be prob, so try...

       $art_title = $row['art_title'];
       $about_art = $row['about_art'];
       $image_link = $row['image_link']; 

Thanks Litebearer! Your help lead me to this which works fine:

 

<table width="100%" border="0" cellpadding=".2em" class="smGrayfont">

<?PHP

/// fyi, the image_link field contains e.g., artistfoldername/imagefilename.jpg

 

$path = "http://xxxxxx.net/xxxxxxxxx/artWorkImages/";

// $path = "../artWorkImages";

$art_id ='2';

 

    $QUERY="SELECT art_title, about_art, image_link FROM artWork WHERE art_id = '$art_id'";

    $res = mysql_query($QUERY);

$num = mysql_num_rows($res);

if($num>0){

 

while($row = mysql_fetch_array($res)){

$art_title = $row['art_title'];

$about_art = $row['about_art'];

      $image_link = $row['image_link'];

 

          echo "<tr align=\"justify\" height=\"100\">

                <td align=\"left\"> <img src=\"$path/$image_link\" height=\"75\" width=\"75\"></td>

<td align=\"left\">$art_title

                  $about_art</td>

</tr>";

}

}

 

?>

</table>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.