Jump to content

storing and retriving paths - help wanted


vfd

Recommended Posts

Hi,

 

I am currently working on my website and am facing a problem.

 

I have a table of this sort...

Table name: persons

The fields are: name, photo, profile.

 

This is for my family website. For each person I have stored their photo link and their profile link.

For example for person1 the fields are...

person1, images/person1/image1.jpg, profiles/person1/index.html

 

When i query the database using \"phpmyadmin\" it shows all the fields. But

when I use the above php script and try to print each field... it prints the name field but shows blank for photo and profile. Could you kindly let me know what i\'m doing wrong.

 

This is the code i use...

 

$result = mysql_query($sqlquery);

 

if ($myrow = mysql_fetch_array($result))

{

do

{

printf(\"%s %s %s<br>\", $myrow[\"name\"], $myrow[\"photo\"], $myrow[\"profile\"]);

}

while ($myrow = mysql_fetch_array($result));

}

Link to comment
Share on other sites

Hey dude,

 

Something i found tough when i was learning Coldfusion, which i have noticed applies the same with PHP, When displaying an image from a database it has to be in an image tag, for e.g.

 

<img src=\"$images\"> Like that. Natrually you add the width and hight if needed.

 

Hope it helps, but i am a newbie too. But try it out anyways. Cheers

Link to comment
Share on other sites

  • 1 month later...

You need to output the HTML required to display the image path too...

 

So for each instance of your loop, you must output:

 

echo "<img src = "";

echo $row["imagepath"];

echo "">";

 

Just as you would to display other HTML - data in table cells etc.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.