View Single Post
  #6 (permalink)  
Old July 8th, 2009, 12:17 PM
cutnedge cutnedge is offline
Registered User
Points: 24, Level: 1
Points: 24, Level: 1 Points: 24, Level: 1 Points: 24, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2007
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Thanks for your help

Joe,
Thanks again for your interest in my problem. Yes, when using a straight ASP call to mySQL the page has no problem displaying the requested information
Here is an example
Code:
<div id="featureProducts">
    <div id="featureProdHeader">
     <p>Featured Items</p>
    </div>
    <div id="featureProd1">
     <%
     Dim strConn, oConn, qry, oRs, strImg
     strConn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=......;"
     strConn = strConn & "DATABASE=........;UID=..........;PWD=.........."
     Set oConn = Server.CreateObject("ADODB.Connection")
     oConn.Open strConn
     qry = "SELECT prodID, prodName, prodSmImg FROM tblProds ORDER BY RAND() LIMIT 1"
     Set oRs = oConn.Execute(qry)
     Response.write "<p>" & oRs("prodID") & "<br />"
     Response.write oRs("prodName") & "<br />"
     strImg = "<img src='images/sm/"
     strImg = strImg & oRs("prodSmImg") & "' />"
     strImg = strImg & "</p>"
     Response.write strImg
     oRs.close
     oConn.close
     Set oRs = nothing
     Set oConn = nothing
     %>
I actually have that same code running to pull the images for feature product 2 and feature product 3 so that it will display random products each time the page is reloaded. It is designed to be the front page of an e-comm store. I had no problem getting that to work. I also have a products page and a prod_desc page that work fine. In fact, on the prods.asp page I have 2 different div sections calling the mySQL database based on which link you click to view product types Here is that code

Code:
<div id="level2LeftNav">
     <%
     Dim strConn2, oConn2, qry2, oRs2
     strConn2 = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=.........;"
     strConn2 = strConn2 & "DATABASE=..........;PWD=............."
     Set oConn2 = Server.CreateObject("ADODB.Connection")
     oConn2.Open strConn2
     qry2 = "SELECT DISTINCT prodSubCat FROM tblProds WHERE prodCat = '" & catName & "'"
     Set oRs2 = oConn2.Execute(qry2)
     if not oRs2.EOF then
     while not oRs2.EOF
     Response.write "<ul><li>" & oRs2("prodSubCat") & "</li>"
     oRs2.movenext
     wend
     oRs2.close
     end if
     Response.write "</ul>"
     oConn2.close
     Set oRs2 = nothing
     Set oConn2 = nothing
     %>
    </div>
    <div id="level2ProdsSection">
     <%
     Dim strConn, oConn, qry, oRs, strImg
     strConn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=..........;"
     strConn = strConn & "DATABASE=.......;UID=..........;PWD=.........."
     Set oConn = Server.CreateObject("ADODB.Connection")
     oConn.Open strConn
     qry = "SELECT prodID, prodName, prodPrice, prodSmImg FROM tblProds WHERE prodCat = '" & catName & "'"
     Set oRs = oConn.Execute(qry)
     if not oRs.EOF then
     while not oRs.EOF
     Response.write "<p>" & oRs("prodID") & "<br />"
     Response.write oRs("prodName") & "<br />"
     strImg = "<img src='images/sm/"
     strImg = strImg & oRs("prodSmImg") & "' />"
     strImg = strImg & "<br />"
     Response.write strImg
     Response.write oRs("prodPrice") & "</p>"
     oRs.movenext
     wend
     oRs.close
     end if
     oConn.close
     Set oRs = nothing
     Set oConn = nothing
     %>
Again, this works fine and as expected. It is just seems to be something that doesn't work when I try to make the call to mySQL from XMLHttpRequest.
Once again, thank you for your interest in my problem. I really appreciate your help
Reply With Quote