Jump to content

[SOLVED] help


seany123

Recommended Posts

using this query:

<?php
$query = $db->execute("select `id`, `username`, `registered`, `level`, `kills`, `deaths`, `hp`, `maxhp`, `rm`, `staff`, `ncolor`, `money`, `gender`, `quote`, `crimes_failed`, `crimes_sucess`, `avatar`, `last_active`, `prison`, `hospital`, `signature`, `rating`, `city_id` from `players` where `username`=?", array($_GET['id']));
$profile = $query->fetchrow();

 

i tried using this if statment and echo:

 

<?php
if($profile['avatar'] == "")
                    {
                    echo "[ AVATAR ]";
                    }
                    else
                    {
                    echo "<img src='$profile->avatar' width='82' height='82' style='border: 1px solid #cccccc'>";
                    }
                    ?>

 

now I know the page knows  what $profile->avatar is because on its echoing [AVATAR] when expected and trying to load a image when expected also.

 

but the image never opens i just get the unloaded image pic.

 

edit: i was thinking that maybe its because it needs to be profile['avatar'] instead of profile->avatar but ive tried and cant get it to work.

 

Link to comment
https://forums.phpfreaks.com/topic/156462-solved-help/
Share on other sites

<?php
if($profile['avatar'] == "")
                    {
                    echo "[ AVATAR ]";
                    }
                    else
                    {
                    echo "<img src='{$profile->avatar}' width='82' height='82' style='border: 1px solid #cccccc'>";
                    }
                    ?>

Link to comment
https://forums.phpfreaks.com/topic/156462-solved-help/#findComment-823859
Share on other sites

<?php
if($profile['avatar'] == "")
                    {
                    echo "[ AVATAR ]";
                    }
                    else
                    {
                    echo "<img src='{$profile->avatar}' width='82' height='82' style='border: 1px solid #cccccc'>";
                    }
                    ?>

 

that didn't work either, it still wont display the image >.<

Link to comment
https://forums.phpfreaks.com/topic/156462-solved-help/#findComment-823866
Share on other sites

seany123, read everyone's reply. Is $profile an array or an object?

 

var_dump($profile);

 

 

array(23) { ["id"]=>  string(1) "1" ["username"]=>  string(9) "adminsean" ["registered"]=>  string(10) "1220148866" ["level"]=>  string(3) "455" ["kills"]=>  string(2) "13" ["deaths"]=>  string(1) "0" ["hp"]=>  string(3) "630" ["maxhp"]=>  string(3) "630" ["rm"]=>  string(2) "14" ["staff"]=>  string(1) "5" ["ncolor"]=>  string(1) "0" ["money"]=>  string(9) "525057138" ["gender"]=>  string(4) "male" ["quote"]=>  string(8) "No Quote" ["avatar"]=>  string(59) "http://helios.gsfc.nasa.gov/image_euv_press.jpg" ["crimes_failed"]=>  string(3) "255" ["crimes_sucess"]=>  string(3) "581" ["last_active"]=>  string(10) "1241221272" ["prison"]=>  string(1) "0" ["hospital"]=>  string(1) "0" ["signature"]=>  string(11) "donkey KONG" ["rating"]=>  string(1) "0" ["city_id"]=>  string(1) "1" }

 

Link to comment
https://forums.phpfreaks.com/topic/156462-solved-help/#findComment-823870
Share on other sites

<?php
if($profile['avatar'] == "")
                    {
                    echo "[ AVATAR ]";
                    }
                    else
                    {
                    echo "<img src='" . $profile['avatar'] . "' width='82' height='82' style='border: 1px solid #cccccc'>";
                    }
                    ?>

 

Get your types straight next time. :)

Link to comment
https://forums.phpfreaks.com/topic/156462-solved-help/#findComment-823871
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.