Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    5

    Unanswered: PHP and MySql connection problem

    Hi all,

    I am using php and mysql.
    i want to add users to database through php page.

    adduser.php
    <html>
    <FORM METHOD="post" ACTION="add.php">
    Real Name: <INPUT TYPE=text MAXLENGTH=70 NAME="real_name" SIZE=20><Br>
    Username: <INPUT TYPE=text MAXLENGTH=70 NAME="username" SIZE=20><Br>
    Password: <Input Type=text Maxlength=70 Name="userpass" Size=10><Br>

    <INPUT TYPE=submit VALUE="Add"> <INPUT type=reset VALUE="Reset Form"></form>
    </tr></td></table></tr></td></table>
    </body>
    </html>

    when i enter the fileds and submit i could not run the see the add.php page,But instead add.php file is opened.

    add.php
    <?

    $ID = uniqid("userID");

    $db = mysql_connect("localhost","root","halfdinner");

    mysql_select_db (userpass);

    $result = mysql_query ("INSERT INTO users (id, real_name, username, password )
    VALUES ('$ID', '$real_name', '$username', '$userpass') ");
    if(!$result)
    {
    echo "<b>User not added:</b> ", mysql_error();
    exit;
    }
    if($result)
    {
    mysql_close($db);
    print "User <b>$username</b> added sucessfully!";
    }
    else
    {
    print ("Wrong Password");
    }
    ?>

    is the problem due to mysql and php connection.i am using windows xp with apache2.

    i followed the steps said by someone in the previous thread.that is adding libmysql.dll to system32 and so on.
    can some one help

  2. #2
    Join Date
    Jan 2005
    Posts
    3
    When you ran your html file, did you double click the file? because if you do, your php content will be displayed....

    try opening a blank browser and type in the address bar:

    http://127.0.0.1/YourFile.html

    GuerillaGeek

Posting Permissions

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