Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

E_Commerce site woes'!

Status
Not open for further replies.

Mrgmk

Programmer
Joined
Dec 4, 2003
Messages
2
Location
US
This is my first post and I am fairly new to PHP and MYSql. I have a site which consists of about 4,500 products. I have written most of it with frontpage in the crude html fashion that I know, but now revision is an issue. I want to be able to store all my products in a database and use PHP (or something)to build a dynamic connection. Here is what I've come up with so far;
-----------------------------------------------------
(header.inc)
<?php
$db = mysql_connect(&quot;localhost&quot;, &quot;user&quot;, &quot;pass&quot;);
mysql_select_db(&quot;dbname&quot;,$db);
?>
<html>
<head>
<title>
<?php echo $title ?>
</title>
</head>
<body>
<center><h2><?php echo $title ?></h2></center>

-----------------------------------------------------

(Default.php)
<?php
$title = &quot;This Page&quot;;
include(&quot;header.inc&quot;);
$result = mysql_query(&quot;SELECT * FROM Products&quot;,$db);
echo &quot;<table border=1>\n&quot;;
echo &quot;<tr><td>ID</td><td>Price</td><td>Description</tr>\n&quot;;
while ($myrow = mysql_fetch_row($result)) {
printf(&quot;<tr><td>%s</td><td>%s</td><td>%s</tr>\n&quot;, $myrow[1], $myrow[2], $myrow[3]);
}
echo &quot;</table>\n&quot;;
include(&quot;footer.inc&quot;);
?>

-----------------------------------------------------

(footer.inc)
<A HREF=&quot;somwhere.htm&quot;>
<A HREF=&quot;somwhere.htm&quot;>
<A HREF=&quot;somwhere.htm&quot;>
</body>
</html>

-----------------------------------------------------

Now, my &quot;Default.php&quot; page gets the data requested and puts it in an html table just fine (big deal), but what I need to do is take the results and create variables to pass to another page. My therory is that with these variables I can display the text description, price, image and an add to cart link from the query results.
OK, I'm confusing myself, maybe somebody gets the idea of what I'm trying to do even with my poor attempt to explain. With my limited knowledge this may not even be the right path to take????. Any comments would be greatly appreciated! Help please!

 
Instead of just outputting the name of the products, output the product names as <a>...</a> links of the form:

<a href=&quot;details.php?product=123&quot;>description</a>

Where &quot;123&quot; is a unique product identifier. details.php takes the product value submitted and uses that to query the database for information on a specific product.


With 4500 products, are you sure you want to write this yourself? There are some good e-commerce products out there -- OSCommerce is good (if perhaps a little complicated due to the fact that it's well-internationalized), is MySQL and PHP based, and free.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
sleipnir,
Thanks for your quick response! I have found a great solution for my sites thanks to you! While checking out the OSCommerce app, I stumbled on a nice and easy &quot;cms&quot; called Mambo. I've installed it on both my sites and will be working on the final touches in the next few days. However I sure to be needing more advice and would welcome your response to my posts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top