SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,711
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php admin ( Database Records )

    hi all

    just a little problem, manage to set up my database via my php admin, i created my html form directing to my .php page on submit, it cums back saying sucessfull and when i check the php admin no records have been added.

    if any 1 could help?


    thanks

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2005
    Posts
    421
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm assuming you've written some sql to insert the data into the database eg Insert into MyTable (Field1, Field2) values (Val1, Val2) <-- something like that? Post that so we can help you.

  3. #3
    Wadge! F4nat1c's Avatar
    Join Date
    Oct 2005
    Location
    South Wales, UK
    Posts
    1,134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Be helpfull if we could see some of your code, as skinny monkey said.
    OMFG SitePoint ROXORZ TEH BIG ONE111!
    Wish you were invisible?

  4. #4
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,711
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php
    //connect to database
    $dbh=mysql_connect ("localhost", "database_", "") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("database_clients");


    //This makes sure they did not leave any fields blank
    if (!$_POST['user_name'] | !$_POST['password']) {
    die('You did not complete all of the required fields');
    }

    //query, get the values from our form
    $user_name = ($_POST['user_name']);
    $password = ($_POST['password']);


    // now we insert it into the database
    $insert = "INSERT INTO users (user_name, password)
    VALUES ('".$_POST['user_name']."', '".$_POST['password']."')";
    $add_member = mysql_query($insert);



    ?>


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
  •