Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2008
    Posts
    3

    Question Unanswered: Need to save inputs in my databse

    I have a website which i currently am publishing on siteground.com

    I am trying to save details of users and other important information to the database. How can i like it to mySQL ???

    I have an SQL on the same site so i dont need to upload it i guess but i really cant find out how to link them together

    Please help

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    would you repeat the question please?

    "How can i like it to mySQL ???"

    also, what does "I have an SQL on the same site" mean?

    are you trying to say microsoft sql server?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2008
    Posts
    3
    oh sorry... i meant i need to link what the input boxex to the database so when they press save or submit it will go directly to the database. On the site im building my website i have mySQL and i have created a table and everything .. soooo please help me out im stuck !!!

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what programming language are you using? php?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Oct 2008
    Posts
    3
    yes on the website im creating it on it says php .. its really confusing for me

    i only know how to use html so im really new to sql

    thanks for replying

  6. #6
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    okay, i'll move this thread to the php forum, and i trust the guys over there will be able to get you started

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

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    In PHP everythign is doen using whats called scripts, a script is basically a series of commands which are interpreted at the server.

    to do what you want you need a script to generate the html which requests the user input, and you need a script to check that input is ok and write good values to the db, or re-direct the user to the input form to remove any errors.

    Teaching iyou how to write PHP, and HTML is beyond the scope of this site, we can and do help with specific problems, primarily how to interat with databases. there are some good rsources out the such as php.net and w3schools.com

    HTH
    I'd rather be riding on the Tiger 800 or the Norton

  8. #8
    Join Date
    Dec 2008
    Posts
    2
    $sql = sprintf("UPDATE `ur table name` SET `blah`='$_POST['blah']' WHERE `userid`='$_POST['userid']'");
    mysql_query($sql);


    or

    $sql = sprintf("INSERT INTO `ur table name` blah blah blah ect if u know what i mean");
    mysql_query($sql);

  9. #9
    Join Date
    Mar 2007
    Location
    010101010110100
    Posts
    803
    roro1989, try this.

    It is a complete script. This should at least get you started.

    Taken from: http://www.w3schools.com/PHP/php_mysql_insert.asp

    PHP Code:
    <?php
    $con 
    mysql_connect("localhost","peter","abc123");
    if (!
    $con)
      {
      die(
    'Could not connect: ' mysql_error());
      }

    mysql_select_db("my_db"$con);

    mysql_query("INSERT INTO Persons (FirstName, LastName, Age) 
    VALUES ('Peter', 'Griffin', '35')"
    );

    mysql_query("INSERT INTO Persons (FirstName, LastName, Age) 
    VALUES ('Glenn', 'Quagmire', '33')"
    );

    mysql_close($con);
    ?>

Posting Permissions

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