SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Apache Expert i_like_php's Avatar
    Join Date
    Nov 2001
    Location
    Dallas, Texas
    Posts
    1,342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie With Databases

    ok guys, i know how to create a database from scratch, but heres my problem. how do i add/delete info from it.... i'm trying to have the database collect info from visitors who visit the site...
    i love php

  2. #2
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What language are you using?
    Back Again

  3. #3
    Apache Expert i_like_php's Avatar
    Join Date
    Nov 2001
    Location
    Dallas, Texas
    Posts
    1,342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by sbdi
    What language are you using?

    i'm using asp
    i love php

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2001
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think he means which RDBMS are you using. If you are using MS SQL Server and ASP, you firstly need to connect to the database, and then use a query/ stored proc to add/delete.

    If your database is on the same machine as IIS, then you can connect like this:

    <%
    dim objConn
    set objConn = Server.CreateObject("ADODB.Connection")

    objConn.Open "Provider=SQLOLEDB; Data Source=(local); Initial Catalog = Pubs; User Id = sa; Password="

    %>

    Next, to add a record to the pubs database (a sample DB provided with MS SQL Server), use this code:

    <%
    dim objComm
    set objComm = Server.CreateObject("ADODB.Command")

    objComm.CommandText = "INSERT INTO Authors(au_lname, au_fname, phone) VALUES('Bloggs', 'Joe', '123456789012')"
    objComm.Execute
    %>

    I have just used the ADODB COmmand object. The command object simply executes queries. You can also use the recordset.addnew() function, but it's too slow.

    If you want more info on databases, checkout the sitepoint articles, or my site in my sig below.

    Hope this has helped
    SiteTell.com: Get the best viral marketing tool on the planet and watch as the number of unique visitors to your site soars!

  5. #5
    Apache Expert i_like_php's Avatar
    Join Date
    Nov 2001
    Location
    Dallas, Texas
    Posts
    1,342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by SpyderMan
    I think he means which RDBMS are you using. If you are using MS SQL Server and ASP, you firstly need to connect to the database, and then use a query/ stored proc to add/delete.

    If your database is on the same machine as IIS, then you can connect like this:

    <%
    dim objConn
    set objConn = Server.CreateObject("ADODB.Connection")

    objConn.Open "Provider=SQLOLEDB; Data Source=(local); Initial Catalog = Pubs; User Id = sa; Password="

    %>

    Next, to add a record to the pubs database (a sample DB provided with MS SQL Server), use this code:

    <%
    dim objComm
    set objComm = Server.CreateObject("ADODB.Command")

    objComm.CommandText = "INSERT INTO Authors(au_lname, au_fname, phone) VALUES('Bloggs', 'Joe', '123456789012')"
    objComm.Execute
    %>

    I have just used the ADODB COmmand object. The command object simply executes queries. You can also use the recordset.addnew() function, but it's too slow.

    If you want more info on databases, checkout the sitepoint articles, or my site in my sig below.

    Hope this has helped

    i'm using an access database. so how do i connect to it and add/delete to it...
    i love php


Bookmarks

Posting Permissions

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