Web Analytics Made Easy -
StatCounter Wrong Parameter Count??? - CodingForum

Announcement

Collapse
No announcement yet.

Wrong Parameter Count???

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wrong Parameter Count???

    Warning: Wrong parameter count for mysql_db_query() in /home/virtual/site8/fst/var/www/html/runeweb/auth.inc.php on line 277

    Warning: Wrong parameter count for mysql_db_query() in /home/virtual/site8/fst/var/www/html/runeweb/auth.inc.php on line 286

    ---------------------
    277 is $sql="SELECT * FROM uuser WHERE user_name='$user_name'";


    286 is $sql="INSERT INTO uuser (user_name,real_name,password,email,remote_addr,confirm_hash,is_confirmed) ".






    What is wrong?

  • #2
    for the first, you have to
    A) take out the ' marks
    PHP Code:
    $sql="SELECT * FROM uuser WHERE user_name=$user_name"
    or

    B)write your code with the concat character
    PHP Code:
    $sql="SELECT * FROM uuser WHERE user_name=".$user_name
    photoshop too expensive? use the GIMP! www.gimp.org

    Comment


    • #3
      Nope

      Im still getting same error

      Comment


      • #4
        In the table that you are inserting values into are these all the fields in that table?

        user_name
        real_name
        password
        email
        remote_addr
        confirm_hash
        is_confirmed

        An insert statement works in this way:

        INSERT INTO tablename (field1, field2) VALUES (value1, value2)

        In which case the values correspond to the matching field name in order.

        In your insert statement you are missing the values section. So in your case your insert statement should look something like:

        $sql="INSERT INTO uuser (user_name,real_name,password,email,remote_addr,co
        nfirm_hash,is_confirmed) VALUES ($user_name, $password, $email, $remote_addr, $confirm_hash, $is_confirmed)"

        assuming that you have those other values stored in variables as well.
        Spookster
        CodingForum Supreme Overlord
        All Hail Spookster

        Comment


        • #5
          Yup

          At the top of my script:


          create table uuser (
          user_id int not null auto_increment primary key,
          user_name text,
          real_name text,
          email text,
          password text,
          remote_addr text,
          confirm_hash text,
          is_confirmed int not null default 0
          );

          Comment


          • #6
            Argh

            Still doesnt work...

            Can I maybe email you the code Spookster?

            Comment


            • #7
              Oh ok so you have an auto increment field in there. Then try this. Note I forgot to put the quotes into the last one:

              $sql="INSERT INTO uuser (user_id, user_name,real_name,password,email,remote_addr,confirm_hash,is_confirmed) VALUES ('NULL','$user_name','$password','$email','$remote_addr','$confirm_hash','$is_confirmed')"

              or since you are inserting values into every field you can leave out the field names like so:

              $sql="INSERT INTO uuser VALUES ('NULL','$user_name','$password','$email','$remote_addr','$confirm_hash','$is_confirmed')"
              Spookster
              CodingForum Supreme Overlord
              All Hail Spookster

              Comment


              • #8
                On a side note.........




                Warning: Wrong parameter count for mysql_db_query()

                Can I just ask quickly how many parameters you are passing in
                the above named query (probably a line or two below your $x =
                "SELECT *....." line.

                You need at least two params

                mysql_db_query('databasename',$queryreference)
                or
                mysql_db_query('databasename',$queryreference,resource_link_identifier)

                if you are not using multiple databases - or have the database
                defined in the mysql_connect bit - you may want to just use
                mysql_query($queryreference);

                As the error return is pointing directly at that function, can you
                test that before testing the value of the $queryreference.

                Subnote: Text editors that tell you which line of a script you are
                on can often yield different results to the error return - 'specially
                if you have included subscripts and blank lines
                ضkii - formerly pootergeist
                teckis - take your time and it'll save you time.

                Comment


                • #9
                  Argh. What else could I have done wrong?

                  I've made sure the table was created.
                  I've made sure the table contained the proper fields
                  I've made sure the Mysql Username and Password e.t.c are correct.

                  I get no errors
                  just a blank page

                  Comment


                  • #10
                    no errors? and you say the table was created? so is the insert statement working as well? If not post all the code that you are using to connect to the db as well as any other code you are using to interact with the db.
                    Spookster
                    CodingForum Supreme Overlord
                    All Hail Spookster

                    Comment


                    • #11
                      run this (just this) and post the returned error...
                      PHP Code:
                      mysql_connect('localhost',$user,$pass)or die(mysql_error());
                      mysql_select_db($database)or die(mysql_error());
                      $sql="INSERT INTO uuser VALUES ('$user_name','$password','$email','$remote_addr','$confirm_hash','$is_confirmed')";
                      mysql_query($sql)or die(mysql_error()); 
                      resistance is...

                      MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

                      Comment


                      • #12
                        hmm Error was


                        Column count doesn't match value count at row 1

                        Comment


                        • #13
                          i think that you have to put "INSERT INTO uuser(colum1, colum2,..) values (value1, value2,)
                          with mySQL if you the number of values you are trying to insert isnt equal to the number of colums in the table then it wront just put the values in any old colum, it will return the error you got
                          photoshop too expensive? use the GIMP! www.gimp.org

                          Comment


                          • #14
                            and try it again with this:

                            PHP Code:

                            mysql_connect
                            ('localhost',$user,$pass)or die(mysql_error());
                            mysql_select_db($database)or die(mysql_error());
                            $sql="INSERT INTO uuser VALUES  ('NULL','$user_name','$password','$email','$remote_addr','$confirm_hash','$is_confirmed')";
                            mysql_query($sql)or die(mysql_error()); 
                            Spookster
                            CodingForum Supreme Overlord
                            All Hail Spookster

                            Comment


                            • #15
                              Same error , Spook

                              Comment

                              Working...
                              X