The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> inserting pictures from databases
minidiapolis
post Oct 12 2011, 02:03 PM
Post #1


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



if you have the urls to pictures in a database how would you display the actual pictures on a webpage?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Oct 12 2011, 02:29 PM
Post #2


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



Have a server-side program retrieves the URLs from the database, then sends HTML that includes those URLs in <img> tags.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 12 2011, 03:13 PM
Post #3


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



here 's what I have so far

<?php
require_once("functions.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
td {
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: #30C;,
border-right-color: #30C;
border-bottom-color: #30C;
border-left-color: #30C;
}
</style>
</head>

<body>
<?php
navBar();
echo "<form action=\"\" method=\"post\" name=\"catalog\">";

DatabaseConnection();

$query = "SELECT * FROM treats";
$result_set = mysql_query($query) or die(mysql_error());
$i = 0;

echo "<table>";
while ($row = mysql_fetch_array($result_set))
{
echo"<tr><td width=\"400px\">($row['product_pic']{$row['product_id']}.<br />{$row['product_title']}.<br /> {$row['product_Description']}.<br />{$row['product_price']}</td></tr>";
}
echo "</table>";
?>
</form>
</body>'
</html>

This post has been edited by minidiapolis: Oct 12 2011, 03:20 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 12 2011, 09:00 PM
Post #4


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



Here 's another question. Can I have two columns with different products in each column?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 13 2011, 12:15 AM
Post #5


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE
here 's what I have so far


Hmm. It is not reasonable to expect someone else to debug your programs for you.

CODE

while ($row = mysql_fetch_array($result_set))
{       echo"<tr><td width=\"400px\">($row['product_pic']{$row['product_id']}.<br />{$row['product_title']}.<br  />  {$row['product_Description']}.<br />{$row['product_price']}</td></tr>";
}


Do you understand what while(...) means?
What do you expect $row to hold for each <table> row that you are generating?
What are all these dots (.) for?
Does this produce a php syntax error, or does it output some html? What does the html look like?

You need to ask yourself questions like these, and learn how to work out what is going on -- this is called 'debugging'.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
minidiapolis
post Oct 13 2011, 09:29 AM
Post #6


Serious Coder
*****

Group: Members
Posts: 437
Joined: 3-September 06
Member No.: 57



I'm NOT asking anyone to do my programming for me! ! This is a really hard subject for me!

This post has been edited by minidiapolis: Oct 13 2011, 09:31 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Oct 13 2011, 12:14 PM
Post #7


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(minidiapolis @ Oct 13 2011, 11:29 PM) *

I'm NOT asking anyone to do my programming for me! ! This is a really hard subject for me!


What I think is unreasonable is posting a whole page of code and just saying "help".

So I picked out what is probably the core problem, and asked some questions about it, of which the first was:

Do you understand what while(...) means?

Well? Do you understand what this while loop does? If you don't quite understand, perhaps we can try to help you. If you do understand fully, then we could go on to the next question. If you don't want to engage with some sort of learning process, and don't want someone to just write your program for you, then I'm at a total loss to know how you think anyone could help.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 06:56 AM