newbie needs help
Page 1 of 4 123 ... LastLast
Results 1 to 15 of 49

Thread: newbie needs help

  1. #1
    Member
    Join Date
    Mar 2012
    Posts
    31

    Thumbs up newbie needs help

    does anyone know of a site that has sql tutorials

  2. #2
    Senior Member dagon's Avatar
    Join Date
    Nov 2001
    Posts
    6,178
    kidding? google shows a few thousand.

  3. #3
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    this is a good place to start:

    http://www.techonthenet.com/

  4. #4
    Member
    Join Date
    Mar 2012
    Posts
    31

    Unhappy DAMIAN

    {this is my code when i enter info into the form fields and press submit the info does not get inserted into my database }
    <?php
    //connect to server and select database
    $con = mysql_connect("localhost", "******", "******",);
    if(!$con)
    {
    die ('Could not connect: ' . mysql_error());


    mysql_select_db("registration", $con);



    //retrieve posted info.
    $username = $_POST['username'];
    $password = $_POST['password'];
    $email = $_POST['email'];



    //insert into database.
    $sql = "INSERT INTO newusers SET username='$username' ,
    password='$password' , email='$email' ";



    //display message.
    if (!mysql_query($sql,$con) )
    {
    die('ERROR:' . mysql_error() );
    }
    echo "Info successfully added!";


    mysql_close($con)

    ?>


    <html>
    <body>
    <!-- Tutorial Description: PHP Forms -->

    <form action="form_success.php" method="post">
    username: <input type="text" name="username" /><br>
    password: <input type="text" name="password" /><br>
    email: <input type="text" name="email" /><br>
    <input type="submit" value="login" />
    </form>

    </body>
    </html>

  5. #5
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    i normally use this metod to insert


    INSERT INTO
    newusers
    (username, password, email)
    VALUES
    ('$username', '$password', '$email' );

    does that work?

  6. #6
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93

  7. #7
    Member
    Join Date
    Mar 2012
    Posts
    31

    Unhappy damian

    that still didnt work what do u think i could be doing wrong??

  8. #8
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    what is the actual error coming up on your screen? if there is one?

  9. #9
    Member
    Join Date
    Mar 2012
    Posts
    31

    Unhappy damian

    do u know of a site that is for complete beginners i have been self teaching myself but i stumbled across php and its a whole another world

  10. #10
    Member
    Join Date
    Mar 2012
    Posts
    31
    when i fill in the 3 form fields and click submit nothing happens just the form fields are emptied

  11. #11
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    first of all run this with data :

    INSERT INTO
    newusers
    (username, password, email)
    VALUES
    ('damianuser', 'damianpass', 'damian@damian.com' );

    obviously with the necessary conenctions, see if that works.


    When you the form is going back to the same page? or to another page? because you have placed < form action="form_success.php" > but i don't know what pages you are using?

  12. #12
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    ok have a look at this tutorial, http://www.tizag.com/phpT/examples/formex.php

    you need to post the results to the same form, because you are going away from the form.

    replace this line:

    <form action="form_success.php" method="post">

    with

    <form action="<?php echo $PHP_SELF;?>" method="post">

  13. #13
    Member
    Join Date
    Mar 2012
    Posts
    31
    i have my code and form on form_success.php and the action for the form is also form_success.php

  14. #14
    newbie php developer Damian_'s Avatar
    Join Date
    Jun 2011
    Location
    london
    Posts
    93
    Quote Originally Posted by mr.zo392011 View Post
    do u know of a site that is for complete beginners i have been self teaching myself but i stumbled across php and its a whole another world
    stay with it, it gets a whole lot easier once you understand a few basics, you will get it just keep going through, might takes hours or days figuring out problems...

  15. #15
    Member
    Join Date
    Mar 2012
    Posts
    31

    Cool damian

    ok thank you i do appreciate it theres not alot of php savvy users on here that want to help without making you feel like an ass

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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