echo
am 28.03.2007 07:07:37 von elk dolk
--0-1818021849-1175058457=:66695
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi all,
I am new to web programming.
I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them.
The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP.
What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with:
Code:
$connex = MySQL_connect(server,login,password);
$sql_query = "select picname from photos where...";
$result = MySQL_query($sql_query,$connex);
$row = MySQL_fetch_array($result);
?>
and then:
Code: echo "";
but I can't see the photo
Any pointers or code samples will be greatly appreciated...
---------------------------------
Bored stiff? Loosen up...
Download and play hundreds of games for free on Yahoo! Games.
--0-1818021849-1175058457=:66695--
Re: echo
am 28.03.2007 07:30:15 von Ron Croonenberg
You might be missing a quote so here and there unless you have the
quotes stored in the database too.
Since your photos are stored on disk, make sure the webserver has
access to them.
Then make sure that your string is something like
in php: printf("", $somepath, $somefilename);
in your php line: echo "";
the line echoed doesn't have any quotes in it.
Ron
elk dolk wrote:
> Hi all,
> I am new to web programming.
>
> I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them.
> The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP.
>
> What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with:
>
> Code:
> $connex = MySQL_connect(server,login,password);
> $sql_query = "select picname from photos where...";
> $result = MySQL_query($sql_query,$connex);
> $row = MySQL_fetch_array($result);
> ?>
>
> and then:
>
> Code: echo "";
>
> but I can't see the photo
> Any pointers or code samples will be greatly appreciated...
>
>
> ---------------------------------
> Bored stiff? Loosen up...
> Download and play hundreds of games for free on Yahoo! Games.
--
============================================================ =====
It's is not, it isn't ain't, and it's it's, not its, if you mean
it is. If you don't, it's its. Then too, it's hers. It isn't
her's. It isn't our's either. It's ours, and likewise yours and
theirs.
-- Oxford Uni Press
============================================================ =====
Ron Croonenberg |
| Phone: 1 765 658 4761
Lab Instructor & | Fax: 1 765 658 4732
Technology Coordinator |
|
Department of Computer Science | e-mail: ronc@DePauw.edu
DePauw University |
275 Julian Science & Math Center |
602 South College Ave. |
Greencastle, IN 46135 |
============================================================ =====
http://www.csc.depauw.edu/RonCroonenberg.html
============================================================ =====
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: echo
am 28.03.2007 07:39:32 von dmagick
elk dolk wrote:
> Hi all,
> I am new to web programming.
>
> I have code to add pictures to a MYSQL database. Now I can't seem to figure out how to get them back out ! so we can see them.
> The MySQL doesn't seem to be a problem (yet), also I'm trying to learn PHP.
>
> What I usually do is to load the images in a folder "img" and then the name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the name of the pic with:
>
> Code:
> $connex = MySQL_connect(server,login,password);
> $sql_query = "select picname from photos where...";
> $result = MySQL_query($sql_query,$connex);
> $row = MySQL_fetch_array($result);
> ?>
>
> and then:
>
> Code: echo "";
>
> but I can't see the photo
> Any pointers or code samples will be greatly appreciated...
Are you storing the whole file in the database or just the path to the file?
If you're storing just the path, then your script is pointing to the
wrong directory and/or the file it's trying to reference doesn't exist
(or a permissions issue maybe).
If you're storing the whole file you need a new php script to pull it
back out.
Then in your html code you do:
echo '';
That will hit 'display_image.php' and pull the image contents out of the
database.
See
http://www.phpriot.com/d/articles/database/images-in-mysql/p age8.html
for an example.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: echo
am 28.03.2007 13:26:55 von Bastien Koert
if you view the source of the generated page, is the image name correct? is
the path to the image correct?
bastien
>From: elk dolk
>To: php-db@lists.php.net
>Subject: [PHP-DB] echo Date: Tue, 27 Mar 2007 22:07:37 -0700 (PDT)
>
>Hi all,
>I am new to web programming.
>
>I have code to add pictures to a MYSQL database. Now I can't seem to figure
>out how to get them back out ! so we can see them.
> The MySQL doesn't seem to be a problem (yet), also I'm trying to learn
>PHP.
>
> What I usually do is to load the images in a folder "img" and then the
>name of the pic (i.e. "myphoto.jpg") in the database, so i retrieve the
>name of the pic with:
>
> Code:
> $connex = MySQL_connect(server,login,password);
> $sql_query = "select picname from photos where...";
> $result = MySQL_query($sql_query,$connex);
> $row = MySQL_fetch_array($result);
> ?>
>
> and then:
>
> Code: echo "";
>
> but I can't see the photo
>Any pointers or code samples will be greatly appreciated...
>
>
>---------------------------------
>Bored stiff? Loosen up...
>Download and play hundreds of games for free on Yahoo! Games.
____________________________________________________________ _____
RealLiveMoms: Share your experience with Real Live Moms just like you
http://www.reallivemoms.ca/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php