Results 1 to 5 of 5

Thread: Databases and HTML

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    New York
    Posts
    74

    Databases and HTML

    I am trying to create a page where it has my database that I have already created. I guewss it requires javascript to do this and it also requires me to connect the database to a web page. I have the code and I think it is connected, but it doesn't work properly. Any ideas?

    Thank you

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Databases and HTML

    Originally posted by rgyankees23
    I am trying to create a page where it has my database that I have already created. I guewss it requires javascript to do this and it also requires me to connect the database to a web page. I have the code and I think it is connected, but it doesn't work properly. Any ideas?

    Thank you
    Care to post the code here? AFAIK, it's not possible to connect to a database using HTML/Javascript.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Dec 2002
    Location
    New York
    Posts
    74
    I can't post the code, so how can i get it to you or on here...

    What does AFAIK mean?

    and thirdly,

    The Book, Beginnning JavaScript, pages 694 from Chapter 16 has a section called, "Accessing Databases from a web page."

    But if it isn't possible then what over way can I do it....

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by rgyankees23
    I can't post the code, so how can i get it to you or on here...
    You can PM it to me, if you'd like.



    What does AFAIK mean?
    As Far As I Know

    and thirdly,

    The Book, Beginnning JavaScript, pages 694 from Chapter 16 has a section called, "Accessing Databases from a web page."

    But if it isn't possible then what over way can I do it....
    THe reason you can't do it is because you're attempting to do it client side. Javascript can access databases, but if it is running as a server side script. If you check Chapter 16, it might mention it somewhere in the beginning itself. For example, if you have PWS or IIS on your machine, you'll be able to use that code.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally sent from rgyankees23 to mendhak

    I have nmo idea what that means

    Here is the code....

    //
    <center>2003 New York Yankees Schedule</center>
    <table border=1>
    <thead>
    <tr>
    <th>GameID</th>
    <th>GameDate</th>
    <th>GameTime</th>
    <th>TeamA</th>
    <th>TeamB</th>
    </tr>
    </thead>
    <%
    var adoConnection = Server.CreateObject("ADODB.Connection");
    var adoRecordset;
    var mySQL;
    adoConnection.Open("DSN=2003yankeeschedule");
    var mySQL = "Select GameID, GameDate, GameTime, TeamA, TeamB"
    adoRecordset = adoConnection.Execute (mySQL);
    while ( adoRecordset.Eof == false )
    {
    %>
    <tr>
    <td><%=adoRecordset ("GameDate").Value%></td>
    <td><%=adoRecordset ("GameTime").Value%></td>
    <td><%=adoRecordset ("TeamA").Value%></td>
    <td><%=adoRecordset ("TeamB").Value%></td>
    </tr>
    <%
    adoRecordset.MoveNext ();
    }
    adoRecordset.Close();
    adoRecordset = null;
    adoConnection.Close ();
    adoConnection = null;
    %>
    </table>
    //
    OK, the code you have posted will work, only server side, as mentioned before. This means that your server must be configured to support and execute ASP scripts. For this, you need a web server such as PWS or IIS.

Posting Permissions

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



Click Here to Expand Forum to Full Width