5 Replies - 742 Views - Last Post: 17 March 2010 - 06:25 AM Rate Topic: -----

#1 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -19
  • View blog
  • Posts: 922
  • Joined: 21-March 09

showing a image with php ?

Posted 16 March 2010 - 10:55 AM

ive been trying to work this out for 3 days now and still ent got it so thought id post on here

i am grabing the image link form a coullum in the db e.g www.mysite.com/image.png

with this lil bit of code

  <?php
									


$db = '';
$con = mysql_connect('localhost', '', '')or die('Error');
mysql_select_db($db);

$query = "SELECT * FROM userbox WHERE username='$myusername'";
$result = mysql_query($query);

while($row = mysql_fetch_assoc($result))
  {
   echo $row['pokemon']." ".$row['pokemonlvl']." ".$row['pokemon_gender']." ".$row['pokemonexp']." <img src='".$row['pokemon_pic']."' alt='' />";
  echo "<br />";
  }
mysql_close($con);
?>



i checked the html on the page and im getting this


p>&nbsp;</p>
						<p>&nbsp;</p>
						<p><br>
						 abra 5 male 456 <img src='www.pokemontoxic.net/pokemon/Treecko.png' alt='' /><br />
						  </p>
						</center>






so its 100% grabing the info from the db but ent showing it ??

This post has been edited by nick1200: 16 March 2010 - 10:57 AM


Is This A Good Question/Topic? 0
  • +

Replies To: showing a image with php ?

#2 huzi8t9  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 25
  • View blog
  • Posts: 367
  • Joined: 11-July 07

Re: showing a image with php ?

Posted 16 March 2010 - 11:22 AM

All I can suggest is make your all of the quotes and double-quotes are ended correctly. For example, if you try and display an image like so:

<img src="path/to/my/image.png>



This will increase the chances of your web page not showing correctly.

Try using Google Chrome, and debug the website. This will tell you of any errors.
Was This Post Helpful? 0
  • +
  • -

#3 moopet  Icon User is offline

  • binary decision maker
  • member icon

Reputation: 343
  • View blog
  • Posts: 1,189
  • Joined: 02-April 09

Re: showing a image with php ?

Posted 16 March 2010 - 11:25 AM

						 abra 5 male 456 <img src='www.pokemontoxic.net/pokemon/Treecko.png' alt='' />



If I understand what you're asking, then the problem is that your image path should start with "http://" -

   echo $row['pokemon']." ".$row['pokemonlvl']." ".$row['pokemon_gender']." ".$row['pokemonexp']." <img src='http://".$row['pokemon_pic']."' alt='' />";


else it's trying to find a folder called www.poke...blahblah on your server somewhere.
Was This Post Helpful? 1
  • +
  • -

#4 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -19
  • View blog
  • Posts: 922
  • Joined: 21-March 09

Re: showing a image with php ?

Posted 16 March 2010 - 11:36 AM

View Postmoopet, on 16 March 2010 - 10:25 AM, said:

						 abra 5 male 456 <img src='www.pokemontoxic.net/pokemon/Treecko.png' alt='' />



If I understand what you're asking, then the problem is that your image path should start with "http://" -

   echo $row['pokemon']." ".$row['pokemonlvl']." ".$row['pokemon_gender']." ".$row['pokemonexp']." <img src='http://".$row['pokemon_pic']."' alt='' />";


else it's trying to find a folder called www.poke...blahblah on your server somewhere.



i will try and add http:// in front of the result in the db and see if that works :)
Was This Post Helpful? 0
  • +
  • -

#5 j33h4d  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 75
  • Joined: 16-March 10

Re: showing a image with php ?

Posted 16 March 2010 - 09:11 PM

moopet's suggestion always work for me :smile2:

View Postmoopet, on 16 March 2010 - 10:25 AM, said:

						 abra 5 male 456 <img src='www.pokemontoxic.net/pokemon/Treecko.png' alt='' />



If I understand what you're asking, then the problem is that your image path should start with "http://" -

   echo $row['pokemon']." ".$row['pokemonlvl']." ".$row['pokemon_gender']." ".$row['pokemonexp']." <img src='http://".$row['pokemon_pic']."' alt='' />";


else it's trying to find a folder called www.poke...blahblah on your server somewhere.

Was This Post Helpful? 0
  • +
  • -

#6 nick1200  Icon User is offline

  • Php Coder
  • member icon

Reputation: -19
  • View blog
  • Posts: 922
  • Joined: 21-March 09

Re: showing a image with php ?

Posted 17 March 2010 - 06:25 AM

Thanks that worked
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1