[php]echo “<img src=‘img/assets/’” . $myC->body . “”;[/php]
In my mysql table. body is set to “myavatar.png”
the code should display a image, but it doesnt work.
[php]echo “<img src=‘img/assets/’” . $myC->body . “”;[/php]
In my mysql table. body is set to “myavatar.png”
the code should display a image, but it doesnt work.
Also
[php]$MyCharacter = $db->query(“SELECT * FROM users WHERE Username=’$User’”);
$myC = $MyCharacter->fetch_object();[/php]
You’re missing the closing > for the img tag.
[php]echo “<img src=‘img/assets/’” . $myC->body . “”>;[/php]
Thanks again, fastsol You seem to be the most active person on this forum (no offence to the others)
No problem, I’m just bored most of the time so I browse the forums a lot.
http://img829.imageshack.us/img829/364/7wnp.png
It seems like cant resolve the path to the image.
I have the image name in my mysql table.
[php]echo “<img src=‘img/assets/’” . $myC->body . “”>;[/php]
[php]$myC->body [/php] is myavatar.png
Sorry missed the fact that the actual image naem is outside the quotes for the src attribute.
[php]echo ‘’;[/php]
I also changed around the quotes for the whole thing. Using single quotes is a better idea when making html elements in php cause html likes “double” quotes best, so using ‘single’ quotes around the whole string is best.
still doesnt work :o
here is the page:
[php]<?php
include ‘header.php’;
if(!$loggedIn) {
echo "
Play free games created by our community
Customize your avatar with the variety of items in our shop
Share the games you create with others and earn bux
Throughout your stay on the website, this page will be your \"home\".
Here you can manage the various aspects of your avatar.
}
[/php]
header.php
[php]
MadBlockz | Under Development?>
[/php]
Well then you need to start doing some basic diagnostic. View the page source and see what it says the image path is in the img tag. Are you sure that $myC->body has a value?
I sourced it.
It seems like it doesnt read it from the mysql database
This is what I found when I sourced:
<div id='homeavatar'><img src="img/assets/ "></div>
This is how my MySQL table looks like:
Direct link to picture: http://img694.imageshack.us/img694/7264/pqo.png
If it’s not getting it from the database it’s likely a query issue. Post the query pwez.
wait, I didn’t see that post.
one sec.
[php]$MyCharacter = $db->query(“SELECT * FROM users WHERE Username=’$User’”);
$myC = $MyCharacter->fetch_object();[/php]
Im so stupid, there was a error in my query
I forgot I changed $User to $loggedIn
Thank you guys