Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2009
    Posts
    6

    Exclamation Unanswered: DataBase = Web Page

    Please, read below and Help!!

    This is what I have to do:
    Download and install the PUBS database onto your computer. File for install script is instpubs.sql in course content.

    Design a Web page(s) that accesses the PUBS database on your computer and does the following processing. The Course Documents section contains a zip file that contains a collection of sample programs to be used for this assignment. When you click on the link for this file, you need to choose the "Save" option and then save the file on your computer. After saving it, you may unzip it to get the files.

    Accept the name of an author and determine if that author is in the database. If it is in the database, display the title ID, title, price, and publication date of all books written by that author on a separate screen. Display an error message otherwise. Also include a link that, when clicked, returns the user to the first screen.

    Zip your files together and upload them in the Digital Drop Box.


    This is what I have:
    Page 1

    <!-- HTML Code To Generate A Form and Accept an Author's Name -->
    <!-- PASS 8 -->

    <form action="Searched Authors.asp">
    <h2>Searched Author's Name</h2>
    <table>
    <tr>
    <td>
    <input type="varchar(20)" name="au_fname" >&nbsp<input type="varchar(40)" name="au_lname" >
    </td>
    </tr>
    <tr><td>&nbsp</td></tr>
    <tr>
    <td>
    <input type="submit" name="submit" value="Lookup" >
    </td>
    </table>
    </form>

    Page 2
    <!-- Author Seach in Database -->
    <!-- PASS8-->

    <table border="1" align="center" cellspacing=3 cellpadding=5>
    <%
    ' ASP Code Starts Here

    ' Connect to the database
    Set conn=Server.CreateObject("ADODB.Connection")
    conn.open "DSN=instpubs.sql"

    ' Retrieve author's name

    searchmyauthor = request("writer")

    ' Execute SQL Query To Get Author's info Obtaining a Result Set Called rp

    set rp = conn.Execute("Select au_id from authors where au_fname = '" & au_lname = '" &_
    searchmyauthor & "'")

    ' Check to see if result set is empty

    if not rp.eof then
    myname = rp("au_id")
    else
    myname = "Unknown"
    end if

    ' Find info for author seleced

    set rc = conn.Execute("SELECT title_id,title,price,pubdate FROM TITLES WHERE authors.au_id=titleauthor.au_id & titleauthor.title_id= titles.title_id'" &_
    searchmyauthor & "'" )

    ' Prepared at their own house

    if not rc.eof then
    response.write( "<tr><td colspan=4><center> <font size=+2>Books Published By " &_
    myname & "</font></center></td></tr>" )

    ' In this part, ASP sends all HTML code to browser as strings

    do while not rc.eof
    response.write("<tr><td>")
    response.write(rc("title_id"))
    response.write("</td><td>")
    response.write(rc("title"))
    response.write("</td><td>")
    response.write(rc("price"))
    response.write("</td></tr>")
    response.write(rc("pubdate"))
    response.write("</td></tr>")
    rc.movenext
    loop

    else
    response.write( "<tr><td colspan=2><center> <font size=+2>No Author foung with name provided " & searchmyauthor & "</font></center></td></tr>" )
    end if

    ' Close connection and free memory
    conn.Close
    Set conn=Nothing



    <a href="PASS 8(01).html">mypage</a>
    %>

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by JoGo1 View Post
    This is what I have:
    sweet
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Nov 2009
    Posts
    6

    What

    Is this correct???

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by JoGo1 View Post
    Is this correct???
    nope

    what happened when you tested it?

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •