Page 1 of 1
user image from mysql (help) :D
Posted: Mon Mar 08, 2010 12:31 pm
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
cant find any guide or info about this
Thanks for looking
_________________________________
Sorry for my english

Re: user image from mysql (help) :D
Posted: Mon Mar 08, 2010 1:15 pm
by lasse48
i got some help via google
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

Re: user image from mysql (help) :D
Posted: Mon Mar 08, 2010 3:00 pm
by hallsofvallhalla
ah yes google is my best friend when searching for help. Nice work on finding the solution.