Jump to content

problem with showing up an image

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
18 replies to this topic

#1
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
hi all im new here and im new to php
i have a problem with showing the image from my mysql database


here is my table im working with from my database

CREATE TABLE upload2 (
id INT NOT NULL AUTO_INCREMENT,
name VARCHAR(30) NOT NULL,
type VARCHAR(30) NOT NULL,
size INT NOT NULL,
path VARCHAR(60) NOT NULL,
PRIMARY KEY(id)
);

here is the code to show the image

<html>
<head>
<title>Download File From MySQL</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>




<?php
$connection = mysql_connect("localhost","root","") or die("impossible de se connecter au serveur mysql.<p>Veuillez réessayer plus tard");
$res = mysql_select_db("upload3") or die("impossible de sélectionner la base de données <b>ecole</b>.<p>Veuillez réessayer plus tard");

$requeteStr = "SELECT path FROM upload2 where id = 4";
$resultatRequete = mysql_query($requeteStr) or die("la requete de sélection a échoué.<p>Veuillez réessayer plus tard");
$result=mysql_query($requeteStr);


while ($row = mysql_fetch_array($result)) 
 {
  $path = $row['path'];
  echo $path;
?>
   <img src="<?$path;?>" border="0">
<?php		
 }
?>


so whats wrong about it ?

it showing me an icone instead of the image... its

sad that because i have just one post, i cant show any screenshot of what its look like atm...

but does anyone has a clue why it shows an icone instead of the image ?

Edited by Jaan, 16 November 2008 - 03:50 AM.
Please use code tags when you're posting your codes!


#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
moved to the correct forum.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I am not entirely sure what you mean. Perhaps upload the screen shot to imageshack or photobucket and post the link, but you have to be clever as to how you post the link, since you don't have enough posts to do that either.

Have you ensured $path is the path to the image, and it does exist?

#4
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
222

333

444

aaa

www

123

lol

lmao

finally 10 tops

sry to have done 10 posts in a row but i need it to show you the images...

here how its look atm

its not the image thats showing up but an icone... why ?

ImageShack - Hosting :: testja6.jpg

and yes all the path exists in my c:\lol\ here is there screenshot

ImageShack - Hosting :: testdc9.jpg

ImageShack - Hosting :: testqt5.jpg

any idea why my image aint showing up ?

Edited by WingedPanther, 14 November 2008 - 07:30 PM.
That wasn't absolutely necessary. Just give us the site but NOT as a link, as John alluded to.


#5
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
This is a funny mistake. You didn't echo/print the path.

<img src="<?=$path?>" border="0"> 

or

 <img src="<?echo $path;?>" border="0"> 

Realize the Web Web services and design.


#6
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
$requeteStr = "SELECT path FROM upload2 where id = 4";
$resultatRequete = mysql_query($requeteStr) or die("la requete de sélection a échoué.<p>Veuillez réessayer plus tard");
$result=mysql_query($requeteStr); 

Another thing i wonder about is why you does the query twice as in above?

#7
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
There was a couple things I was going to point out about his MySQL techniques but I figured I'd just help him with this problem and not bug on how he fetches from MySQL.

Realize the Web Web services and design.


#8
Brandon W

Brandon W

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 4,828 posts
Not to sure, but from the posts above should help you. Mainly the echo command LOL!!
jQuery Selectors Tutorial - jQuery Striped Table tutorial - jQuery Events - jQuery Validation

Sorry if I don't post as often as I did, I'll try to get here as much as possible! I'm working my bum off to get this scholarship and other stuff!


#9
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts
you guys are maybe pro at php but you guys are moron about the life and how you laugh at someone who needed help im sure u guys werent so good at start in php too

anyway **** off and bye

and the image doesnt show up even with echo
i just see the icone again
you pros...
so ty for the big help...
chow lollllllllllllll


and you can ban me i dont care lollllll

#10
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Then don't ask for help. You brought it on your self.

Realize the Web Web services and design.


#11
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,299 posts
I disagree abit. i see no point laughing at anyone for asking whatever stupid it might seem.
we lost a user because a misplaced "LOL", and that's sad.

I have taught about a -rep for that, but i haven't done it.

#12
nicnicnic

nicnicnic

    Newbie

  • Members
  • PipPip
  • 16 posts

mikelbring said:

Then don't ask for help. You brought it on your self.

i ask for help, not to be laugh at

at least orjan seem to be more mature than you

cya i will find it out myself