Click to See Complete Forum and Search --> : Confused newbie in desperate need of some insight!
scarlet.indigo
01-24-2003, 07:42 PM
Hi everyone.
Maybe I'm just dense, I'm not sure. But I've been poking about the Internet for a few hours now, trying to find an online resource to teach me about dynamic web pages and database integration and such. I've been doing web design for a few years now, but I've learned I need to break outta the .html mode and learn a few new things.
Here's the trouble. I am developing a site for a client who sells ink cartridges. Now, rather than create a seperate HTML page for every single type of cartridge they sell (we're talking upwards of 100 pages, easy), I'd love to use some kind of language that would query an Access database and display only the information I need.
I've read a bit about ASP and Perl, but they both go right over my head. ColdFusion and PHP look more promising, but again I'm very much a newbie and after wading through tutorials that sound as though they were written for Comp Sci majors rather than little webpage designers, I'm frustrated.
Anyone know of any websites or resources I could go to? Being fairly impatient (and on a bit of a deadline) I don't have much time to learn any of these languages upside-down and inside-out. All I need is a way around having to create 100 html pages. Is that too much to ask? :)
Thanks in advance for the help!
Jessie
Stefan
01-24-2003, 10:44 PM
Originally posted by scarlet.indigo
Being fairly impatient (and on a bit of a deadline) I don't have much time to learn any of these languages upside-down and inside-out. All I need is a way around having to create 100 html pages. Is that too much to ask? :)
www.phpnuke.org is a freeware compleate solution using PHP and MySQL that does exactly what you need.
Shouldn't take too many days to get that 100 pages up and running, and you can always read up on the PHP specifc things later on. :)
scarlet.indigo
01-25-2003, 05:19 PM
Hi Stefan,
I wish I could say you've found the cure, but PHP-Nuke doesn't appear to be what I need either.
I guess what I'm looking for is a way to create one template page that loads different products, depending on which printer model the user clicks on. I have all the products in an access database, so if there was a way to parse the database and grab only the products specific to a certain printer model, it would make my life a whole lot easier!
But as I said before, maybe I'm just dense. It's just frustrating when a concept seems so simple but the easy solution is so hard to find!!
Off to search google again ...
Jessie
Ribeyed
01-25-2003, 09:10 PM
what you are looking to do wouldn't need much learning if you go down the ASP root. If you feel you can us ASP then i can pst you some code etc to get you started
scarlet.indigo
01-26-2003, 03:05 PM
Hey Ribeyed ...
I'm game to try ASP, but unfortunately I have very little time (I'm hoping to have the bulk of the site done by tomorrow) so I'm going to start out with what I know, and if you could give me a little push with the code that would be fantastic.
I appreciate your help!
Jessie
Ribeyed
01-26-2003, 05:15 PM
Hi,
Sure, no problem here is a start for you; I will try to keep it simple.
Set up access to have the following tables:
tblCategory
CatID*
CatName
CatDescription
tblProduct
ProdID*
ProdName
ProdDescription
ProdSellPrice
And what ever else you need to store about a product
tblProductCategory
ProdID*
CatID*
3 tables, 1 for categories, 1 for products and the 3rd is a relationship table to normalise the many-to-many situation. This will allow you to have a product that can be in many categories.
Ok once you have your database build you need to create an ODBC connection. IF you don’t know how to do this I will give you instructions in next post.
So what you are building is 2 pages. 1 page to display the categories and another to display the products in the category.
This is the code for your first page the category page:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Category Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
set yourDB = server.createobject ("adodb.connection")
yourDB.open "yourdatabaseDNSName"
sqltext = "SELECT * FROM tblCategories"
set catset = yourDB.Execute(sqltext)
While not catSet.EOF
%>
<table >
<tr>
<td><%=catset("CatID")%></td>
<td><A href="/productspage.asp?CatID=<%=catset("catID")%>"><%=catset("CatName")%></A></td>
<td><%=catset("CatDescription")%></td>
</tr>
</table>
<%
catset.movenext
wend
catset.close
set catset = nothing
%>
<%
yourDB.Close
set yourDb = nothing
%>
</body>
</html>
now your products page will look like this:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
set yourDB = server.createobject ("adodb.connection")
yourDB.open "yourdatabaseDNSName"
pcatId = request.querystring("catID")
sqltext = "select tblProducts.ProdId, tblProducts.ProdName, tblProducts.ProdDescription, "
sqltext = sqltext & "tblProductCategory.ProdID, tblProductCategory.CatID "
sqltext = sqltext & "FROM tblProducts, tblProductCategory "
sqltext = sqltext & "WHERE tblProducts.ProdID = tblProductCategory.ProdID "
sqltext = sqltext & "AND tblProductCategory.CatID = "&pCatID&""
set prodSet = yourDB.Execute(sqltext)
while not prodSet.eof
%><table>
<tr>
<td><%=prodSet("ProdID")%></td>
<td><%=prodSet("ProdName")%></td>
<td><%=prodSet("ProdDescription")%></td>
</tr>
</table>
<%
prodSet.Movenext
wend
prodset.close
set prodset = nothing
yourDB.close
set yourDb = nothing
%>
</body>
</html>
Ok that’s as simple as it gets, you need to beef it up a bit, add in error trapping, page formatting etc.
Hope this helps