Jump to content
MakeWebGames

Recommended Posts

Posted

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" |

|------------------------------------------|

Posted

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.

Posted
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.

Posted

Create a new row in the table and name it images then link it through that way. Do you know how to do that?

Posted
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?

Posted

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']) . '" />

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...