artworthy Posted September 30, 2010 Share Posted September 30, 2010 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 Quote Link to comment Share on other sites More sharing options...
litebearer Posted September 30, 2010 Share Posted September 30, 2010 perhaps... while($row = mysql_fetch_array($res)){ $artist_name = $row["art_title"]; $about_art = $row["about_art"]; $image_link = $row["image_link"]; ?> <img src="<?PHP echo $path . $image_link; ?>"> <?PHP } Quote Link to comment Share on other sites More sharing options...
artworthy Posted September 30, 2010 Author Share Posted September 30, 2010 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 Quote Link to comment Share on other sites More sharing options...
litebearer Posted September 30, 2010 Share Posted September 30, 2010 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']; Quote Link to comment Share on other sites More sharing options...
artworthy Posted October 1, 2010 Author Share Posted October 1, 2010 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.