how to add data from html table(rendered from a page) to mysql database using php..?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhishek1234321
    New Member
    • Jul 2010
    • 18

    #1

    how to add data from html table(rendered from a page) to mysql database using php..?

    I have a form at http://www.vtuhub.com/w.html which shows results if a proper roll number is entered... the results are fetched from http://results.vtu.ac.in site and only the table is shown... now i want to add the data of the table to my database using php.

    Is there a way to do it..?

    for example if the roll number entered is 1rn06cs006

    the page will show the results as
    Semester: 8 Result: FIRST CLASS WITH DISTINCTION

    Subject External Internal Total Result
    Advanced Computer Architectures (06CS81) 59 23 82 P
    System Modeling and Simulation (06CS82) 55 22 77 P
    Project Work (06CS85) 97 97 194 P
    Information and Network Security (06CS835) 59 20 79 P
    Seminar (06CS86) 0 49 49 P
    Programming Languages (06CS846) 60 24 84 P


    Total Marks: 565


    now i want the data from this table to be stored to my database so that if the same roll number is searched again... the result should be shown from my database and not from http://results.vtu.ac.in... help me out pls..:)
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    #2
    The easiest way would probably be just to store HTML for your table into the database referencing it with the roll number.

    Comment

    • abhishek1234321
      New Member
      • Jul 2010
      • 18

      #3
      can u give me some link.. where this type of thing has been shown...:)
      i'm storing the table's name as the roll number... but how should i extract the data from html..? :)

      Comment

      • nishmu
        New Member
        • Aug 2010
        • 1

        #4
        The results website uses POST method, but currently as I can see... you are trying to get results using GET method.

        You can use CURL to send the roll number to the form. You can google to find more about CURL, in particular curl_setopt function.

        As for storing the data... since you only need to display the result of a particular roll number, and not work on/manipulate the data, saving the plain vanilla HTML to the database would be easiest.

        "but how should i extract the data from html..?"
        There are many options.. using Regular expressions, PHP DOM to get particular elements.

        Comment

        Working...