PDA

View Full Version : I am very needing yours about asp


trungsonqlkd
Aug 24, 2006, 12:34 AM
Hi,
I am VIetnammes I am studying informatic technonogy. I am studying shopping cart, I downed this demo ones is acart2_0 , but I have problem in error.
In eacht pages that have SQL inner join that it don't run
this code example
<%@ LANGUAGE = "VBScript" %>
<!-- #include file="db.asp" -->
<!-- #include file="config.asp" -->
<!-- #include file="functions.asp" -->
<!-- #include file="wishlist.asp" -->

<%
productid=valid_sql(request.querystring("productid"))

if productid=null or productid="" or not(isnumeric(productid)) then
response.redirect("error.asp?msg=" & Server.URLEncode("We have no record of the product you are looking for."))
end if

'get the relevant products details
set rsprod=db.execute("SELECT * FROM products INNER JOIN categories ON products.catcode = categories.catcode WHERE products.productid = " & productid)

if rsprod.eof then
response.redirect("error.asp?msg=" & Server.URLEncode("We have no record of the product you are looking for."))
end if


if request.querystring("wish")="add" then
WISHLIST_add(productid)
end if

'get names and codes of all products in that category
set rscatlist=db.execute("select name,productid from products where catcode=" & rsprod("catcode") & " order by name")
%>
<html>

<head>
<title>
<%= storename %>
</title>

<body bgcolor="<%= bgcolor %>" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" text="<%= text %>" alink="<%= COLlight %>" link="<%= COLlight %>" vlink="<%= vlink %>">
<font face="arial">
<%
header

categorymenu
%>


<table>
<td valign=top align=right>
<font face="helvetica" size="3" color="<%= COLdark %>"><B><%= rsprod("catname") %></B></font>
<br>
<%

'Display list of other products in category
if not rscatlist.eof then
rscatlist.movefirst
while not rscatlist.eof
%>
<font size="1" face="helvetica" color="<%= COLlight %>">
<a href="product.asp?productid=<%= rscatlist("product.asp?productid=<%= rscatlist(")%>"><%=rscatlist(")%>")%></a>
<br>
<%
rscatlist.movenext
wend
end if
%>
</td>

<td>
<% = rsprod("name") %>
</td>

<td width=180 align="image">
<font size="left" face="3" color="helvetica">
<b><%= rsprod("<%= text %>") %></b>
<br>
<table width=180 border=0>
<tr>
<td align="name">
<font size="left" face="2" color="helvetica">
<b>Price:</b>
</td>
<td align="<%= COLdark %>">
<font size="right" face="2" color="helvetica">
<% if rsprod("saleprice"<%= text %>"" or rsprod("saleprice")=0 then %>
<% =cursymbol & formatnumber(rsprod("price" or rsprod("price")) %>
</strike>
</tr>
<tr>
</td>
<td><font size=")=0 then %>
<% =cursymbol & formatnumber(rsprod(" face=")) %>
<% else %>
<strike>
<% =cursymbol & formatnumber(rsprod(" color="<%= COLsale %>">
Sale Price:
</td>
<td align=")) %>
</strike>
</tr>
<tr>
</td>
<td><font size=">
<font size=" face=" face=" color=" color="<%= COLsale %>">
<b><% =cursymbol & formatnumber(rsprod(">
Sale Price:
</td>
<td align=")) %></b>
<font size=">
<font size=" face=" face=" color=" color=">
<% end if %>

</td>
</tr>
</table>
<br>


<font size=">
<b><% =cursymbol & formatnumber(rsprod(">
<%= rsprod("description")) %></b>
<font size="addprod.asp?productid=<%= rsprod(" face=")%>" color="https://www.askmehelpdesk.com/images/purchase.gif" border=0></a>
<% if not(WISHLIST_element(rsprod(">
<% end if %>

</td>
</tr>
</table>
<br>


<font size="))) then %>
<br>
<a href="product.asp?productid=<%= rsprod(">
<%= rsprod(")%>&wish=add") %>
<br><br>
<center>
<a href="https://www.askmehelpdesk.com/images/addwish.gif" border=0></a>
<% end if %>
</td>




</table>

<% footer %> </font>

</body>
</html>

<%
db.close
set db=nothing
%>
----------------------
while run it have error in row :

set rscatlist=db.execute("select name,productid from products where catcode=" & rsprod("catcode") & " order by name")

-------------------------
I think it don't run in : &rsprod("productid") because SQL inner join don' runt
I think this Stament is fasle...

I thank who can help me?

trungsonqlkd
Aug 24, 2006, 12:46 AM
http://www.alanward.net/acart/acart20.asp

I downloald this shooping cart but it don't run.
I want help
I code error in SQL that have inner jion

You try down and find error help me
Thank you.

ScottGem
Aug 24, 2006, 05:50 AM
What database are you running in the back end? If you are going against an Access (Jet) database then you may need to close your SQL statements with a ; like so:

SELECT * FROM products INNER JOIN categories ON products.catcode = categories.catcode WHERE products.productid = " & productid & ";"

Also, have you tried testing your queries directly to make sure the SQL works and the right records arer returned?