Results 1 to 2 of 2

Thread: Php sign up help !

  1. #1

    Php sign up help !

    hello good day to everone, anyway im a newbie on php, and im creating a website which requires sign up or registration before entering the site, anyway Im using MySQL for back-end(database). hope u can help me guys, thanks in advance... heres my code but it has an error " Warning: Wrong parameter count for mysql_connect() in C:\wamp\www\webtry\check_signup.php on line 28
    Cannot connect to database
    "

    This is my code :

    <html>


    <title>


    </title>


    <head>
    <link rel="stylesheet" type="text/css" href="layout.css" />
    <link rel="shortcut icon" href="clown.png" />


    </head>


    <body>


    <?php


    $host= "localhost";
    $username="";
    $password="";
    $age="";
    $fname="";
    $lname="";
    $id= "";


    $db_name="test";
    $tbl_name="member";


    mysql_connect("$host", "$username", "$password", "$fname", "$lname", $age) or die("Cannot connect to database");
    mysql_select_db("$db_name") or die ("Cannot select DB!");


    $myfirstname=$_POST['myfirstname'];
    $mylastname=$_POST['mylastname'];


    $myage= $_POST['myage'];


    $myusername=$_POST['myusername'];
    $mypassword=$_POST['mypassword'];




    $check= "SELECT * FROM $tbl_name WHERE username= '$myusername' and password= '$mypassword' AND
    fname= '$myfirstname' AND lname= '$mylastname' AND age= $myage ";


    $qry= mysql_query($check) or die ("Could not match");
    $num_rows = mysql_num_rows($qry);


    if($num_rowns !=0)
    {
    echo "Sorry, the username $myusername is already taken.";
    exit;
    }
    else
    {
    $insert = mysql_query("INSERT INTO $tble_name VALUES('NULL','$myusername', '$mypassword', '$myfirstname', '$mylastname', '$myage'")
    or die("Could not insert data");
    }


    ?>


    </body>


    </html>
    Last edited by raphaelle; April 30th, 2012 at 09:35 AM. Reason: Forgot my codes.

  2. #2
    Hi, Its simple... the error says

    "Warning: Wrong parameter count for mysql_connect() "

    what that means is that you have the wrong number of paramers in the function mysql_connect().
    it only requires

    mysql_connect("host", "username", "password")

    So u need to remove your extra vars such as "$fname", "$lname", $age)"... and then try it...

    REF: http://www.phpeasystep.com/mysql/4.html

    Hope this helps

    Click here to read the signature guidelines for the forums.
    Reason: please see footer dimension rules

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012