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("localhost", "user", "pass"
;
mysql_select_db("dbname",$db);
?>
<html>
<head>
<title>
<?php echo $title ?>
</title>
</head>
<body>
<center><h2><?php echo $title ?></h2></center>
-----------------------------------------------------
(Default.php)
<?php
$title = "This Page";
include("header.inc"
;
$result = mysql_query("SELECT * FROM Products",$db);
echo "<table border=1>\n";
echo "<tr><td>ID</td><td>Price</td><td>Description</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td><td>%s</td><td>%s</tr>\n", $myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
include("footer.inc"
;
?>
-----------------------------------------------------
(footer.inc)
<A HREF="somwhere.htm">
<A HREF="somwhere.htm">
<A HREF="somwhere.htm">
</body>
</html>
-----------------------------------------------------
Now, my "Default.php" 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!
-----------------------------------------------------
(header.inc)
<?php
$db = mysql_connect("localhost", "user", "pass"

mysql_select_db("dbname",$db);
?>
<html>
<head>
<title>
<?php echo $title ?>
</title>
</head>
<body>
<center><h2><?php echo $title ?></h2></center>
-----------------------------------------------------
(Default.php)
<?php
$title = "This Page";
include("header.inc"

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

?>
-----------------------------------------------------
(footer.inc)
<A HREF="somwhere.htm">
<A HREF="somwhere.htm">
<A HREF="somwhere.htm">
</body>
</html>
-----------------------------------------------------
Now, my "Default.php" 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!