JTapp Posted February 18, 2008 Share Posted February 18, 2008 Problem: I need to display an image (unique to my ID field) and display it on my webpage. At this point my stomach turns when I look at my existing code (I'm soooo new at this). But I have to somehow add to my code to get this done. Any help is greatly appreciated. There are three tables, the newest one is called 'tblLodgePics'- this is where I'm storing my image data. The code below is trying to find the 'link' and display it that way. (also known as $variable20 below). I have created a bin_data to upload the images to via another PHP page, but I haven't figured that out yet... I need a script for it. It currently has the following fields in my tblLodgePics: id varchar(15), description varchar(255), bin_data LONGBLOB, filename varchar(50), filesize varchar(50), filetype varchar(50), link varchar(255), shownno integer(5), clickcount integer(5), lngLodgeID (this is my unique field that can be found in the other 2 tables) Here is my current code to view it in (unformatted) action go to: http://www.la-mason.com/search15.html and search for 'Lodge Name' = "Abbeville". I basically need to embed Abbeville's photo into this page: //query details table begins $query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeWEB, tblLodges.strLodgeCounty, tblLodges.dtChartered, tblLodges.strLodgeAddress, tblLodges.strLodgeAddress2, tblLodges.strLodgeLocationCity, tblLodges.strLodgeLocationState, tblLodges.strLodgeLocationZip, tblLodges.strLodgeEmail, tblLodges.strLodgePhone, tblLodges.strLodgeFax, tblLodges.strDrivingDirectons, tblLodges.dtMeetingTime, tblLodges.dtMealTime, tblLodges.strFloorSchool, tblLodges.strLodgeNews, tblOfficers.strFirstName, tblOfficers.strLastName, tblLodgePics.link FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID LEFT JOIN tblLodgePics ON tblLodgePics.lngLodgeID = tblLodges.lngLodgeID WHERE $metode LIKE '%$search%' GROUP BY tblLodges.strLodgeName LIMIT 0, 50"); while ($row = @mysql_fetch_array($query)) { $variable1=$row["strLodgeName"]; $variable2=$row["intLodgeNumber"]; $variable3=$row["strDistrictName"]; $variable4=$row["strLodgeWEB"]; $variable5=$row["strLodgeCounty"]; $variable6=$row["dtChartered"]; $variable7=$row["strLodgeAddress"]; $variable8=$row["strLodgeAddress3"]; $variable9=$row["strLodgeLocationCity"]; $variable10=$row["strLodgeLocationState"]; $variable11=$row["strLodgeLocationZip"]; $variable12=$row["strLodgeEmail"]; $variable13=$row["strLodgePhone"]; $variable14=$row["strLodgeFax"]; $variable15=$row["strDrivingDirectons"]; $variable16=$row["dtMeetingTime"]; $variable17=$row["dtMealTime"]; $variable18=$row["strFloorSchool"]; $variable19=$row["strLodgeNews"]; $variable20=$row["link"]; //table layout for results print ("<tr>"); echo '<p><h3>' . $variable1 . '</h3></p><p>' . $variable2 . '</p>'; echo '<p>' . $variable3 . '</p>'; echo "<a href=\"$variable4\">Click Here To Go To The Lodge Website</a>"; echo '<p>' . $variable5 . '</p>' . $variable6 . '</p>'; echo '<p>' . $variable7 . '</p>' . $variable8 . '</p>' . $variable9 . '</p>' . $variable10 . '</p>' . $variable11 . '</p>'; echo "<a href=mailto:\"$variable12\">Click Here To Email The Lodge</a>"; echo '</p>' . $variable13 . '</p>' . $variable14 . '</p>'; echo '<p>' . $variable15 . '</p>'; echo '<p>' . $variable16 . '</p>' . $variable17 . '</p>' . $variable18 . '</p>'; echo '<p>' . $variable19 . '</p>'; echo '<p>' . $variable20 . '</p>'; print ("</tr>"); } ?> </tr> </table> <hr width=75% align=center size=4> <p><strong>Roster of Lodge Officers </strong></p> <p> <?php //query details table begins $query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeLocationCity, tblLodges.strLodgeLocationZip, tblLodges.strLodgeCounty, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE $metode LIKE '%$search%' LIMIT 0, 50"); $results=mysql_query($query); echo "<table border='1'> <tr> <th>Officer First</th> <th>Officer last</th> <th>Officer Email</th> <th>Officer Phone</th> </tr>"; // while ($row = mysql_fetch_array($query)) { $variable1=$row["strFirstName"]; $variable2=$row["strLastName"]; $variable3=$row["PersEmail"]; $variable4=$row["BusinessPhone"]; //table layout for results print ("<tr>"); echo "<td class=\"td_id\"><h3>$variable1</h3></td>\n"; echo "<td class=\"td_id\"><h3>$variable2</h3></td>\n"; echo "<td class=\"td_id\"><h3>$variable3</h3></td>\n"; echo "<td class=\"td_id\"><h3>$variable4</h3></td>\n"; echo "<td class=\"td_id\"><h3>$variable5</h3></td>\n"; print ("</tr>"); } ?> Quote Link to comment Share on other sites More sharing options...
53329 Posted February 18, 2008 Share Posted February 18, 2008 Well the generated source has no image tag. That could be a part of the problem. Is there one in the PHP code somewhere? If not thats the problem, if yes the problem is around that code. 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.