user image from mysql (help) :D

Location of the Videos
Post Reply
User avatar
lasse48
Posts: 6
Joined: Sun Mar 07, 2010 9:25 pm

user image from mysql (help) :D

Post by lasse48 »

hello

i realy want to do so when you login , it shows a img on site , it get img name from mysql. the img file is in www.

fx. if you got a tabel name: city in players:

http://www.stargate-sg1.dk/lasse/image/1.jpg
http://www.stargate-sg1.dk/lasse/image/2.jpg

it coud be nice with a div. where the pic needs to be :D

cant find any guide or info about this :(

Thanks for looking


_________________________________

Sorry for my english :D
User avatar
lasse48
Posts: 6
Joined: Sun Mar 07, 2010 9:25 pm

Re: user image from mysql (help) :D

Post by lasse48 »

i got some help via google :D

hers the city.php:

Code: Select all

<?php
include_once 'connect.php';
session_start();

include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}

$data = mysql_query("SELECT * FROM picture")

or die(mysql_error());

while($info = mysql_fetch_array( $data ))

{

print "<div style='text-align:left; padding-bottom:30px; margin-left:20px;'>";

print " " . $info["Picture"] . "";

print "</div>";

}

?>
</div>
<div id ="locations">
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerhp = $playerinfo3['hpoints'];
if ($playerhp < 1)
{
  echo "You are dead!" ;
  echo "<br><a href='useitem.php>Use an Item";
  exit;
}

echo "<b><big><u>Locations</u></big></b><br>";
echo "<a href='store.php'>Visit Store<br>";
echo "<a href='battle.php'>Battle in Arena<br>";
?>
</div>
<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>




sampel:
http://www.stargate-sg1.dk/lasse/image/123456vi.jpg

how the sampel picture is showing. just need to do it so its a unique img , so each player can have picture not looking the same :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: user image from mysql (help) :D

Post by hallsofvallhalla »

ah yes google is my best friend when searching for help. Nice work on finding the solution.
Post Reply

Return to “Older Browser MMO Videos”