Seker Posted May 12, 2012 Posted May 12, 2012 I'm trying to do a visual update on my city page to include some images. Been tinkering to keep the cities only showing if the level requirement is met. Now, the level requirement part is actually working. But, the problem is, I have 19 cities, and it shows each row 19 times. I know I'm missing something in the if statements. Any ideas? How my if's are set up: $lev = $ir['level']; if ($lev >= 0) { print " <tr> <td><img src='images/tentcity.png'></td> <td>{$r['citydesc']}</td> <td><img src='images/0.png'></td> <td><a href='monorail.php?to={$r['cityid']}'><img src='images/go.php'></a></td> </tr>"; } Example of how it shows up on the page: |------------------------------------------| |"cityname1" | "citydesc1" | "Go" | |------------------------------------------| |"cityname1" | "citydesc1" | "Go" | |------------------------------------------| |"cityname1" | "citydesc1" | "Go" | |------------------------------------------| |"cityname2" | "citydesc2" | "Go" | |------------------------------------------| |"cityname2" | "citydesc2" | "Go" | |------------------------------------------| |"cityname2" | "citydesc2" | "Go" | |------------------------------------------| Quote
Djkanna Posted May 12, 2012 Posted May 12, 2012 I don't recall much about the city page. But doing something like; while ($loc = $db->fetch_row($locations)) { if ($ir['level'] >= $loc['levelRequirement']) { echo '<tr><td>....</td></tr>'; } } May work. Quote
Seker Posted May 12, 2012 Author Posted May 12, 2012 I don't recall much about the city page. But doing something like; while ($loc = $db->fetch_row($locations)) { if ($ir['level'] >= $loc['levelRequirement']) { echo '<tr><td>....</td></tr>'; } } May work. I believe the problem with this is, I would still be limited to using one image for every city. I'm trying to use separate images for each city. Quote
Guest Posted May 12, 2012 Posted May 12, 2012 Create a new row in the table and name it images then link it through that way. Do you know how to do that? Quote
Seker Posted May 12, 2012 Author Posted May 12, 2012 Create a new row in the table and name it images then link it through that way. Do you know how to do that? Would I do it just like the display_pic column in users? Set it as text and insert the link? Quote
Dave Posted May 12, 2012 Posted May 12, 2012 Just to quickly point it out you need the file extension of the image format you decide to use (.png,.jpg.gif.. etc) <img src="images/cities/' . $res['cityID'] . '.jpg" alt="' . htmlspecialchars($res['cityNAME']) . '" /> Quote
Seker Posted May 12, 2012 Author Posted May 12, 2012 Ahh Thank you all. Will give this a shot and see how it comes out. Quote
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.