Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 34
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 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
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nope

    Im still getting same error

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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
    );

  • #6
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Argh

    Still doesnt work...

    Can I maybe email you the code Spookster?

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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
    CodingForums Supreme Overlord
    All Hail Spookster

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #9
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #10
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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
    CodingForums Supreme Overlord
    All Hail Spookster

  • #11
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,040
    Thanks
    10
    Thanked 92 Times in 90 Posts
    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)

  • #12
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hmm Error was


    Column count doesn't match value count at row 1

  • #13
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #14
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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
    CodingForums Supreme Overlord
    All Hail Spookster

  • #15
    New Coder
    Join Date
    Jun 2002
    Location
    United States
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Same error , Spook


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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