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 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by Jian0203 View Post
    Thank you for suggestion. I tried
    PHP Code:
            mysql_query("insert into customerdetail(customer_id,customer_pass1,customer_pass2,customer_pass3,customer_pass4,customer_pass5,customer_email) values ('$customername','$password1','$password2','$password3','$password4','$password5','$email')");
            
            if (
    mysql_query(sQuery)) 
    Thats wrong. You should be doing something like:

    $Query = "_your_query_here";

    if (mysql_query($Query))

    Note that the $ at the front of $Query is a DOLLAR sign not an actual S for sierra which you have used.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  2. #17
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    PHP Code:
    <?php
    $query 
    mysql_query('SELECT customername FROM customerdetail WHERE customername = $customername'); 

    if (
    mysql_num_rows($query) > 0) { 
         echo 
    'Username already in use! Please choose another '.$examples
    } else { 
        
    //register the user.
    }  
    ?>
    //You don't have to use $examples but it's a cool feature i.e username_291, firstname_lastname_121

    Select may make the sql server to crash, but if you're running on it a good server is very unlikely.

    You can also add some flood prevention to prevent is; I cant seem to think of another method which is very easy for you to understand and edit.
    Last edited by tempz; 01-04-2013 at 01:07 AM.

  3. #18
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    tempz:

    Did you not notice that the op is using mysqli? (Note the i).

    Your code is not useful here.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  4. #19
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Quote Originally Posted by tangoforce View Post
    tempz:

    Did you not notice that the op is using mysqli? (Note the i).

    Your code is not useful here.
    Where? No need to be rude also! I have checked his code.. he is using " mysql_query" so am I.

    Where is the problem.

    Plus, I'm not reading what you guys have replied..
    Last edited by tempz; 01-04-2013 at 01:39 AM.

  5. #20
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,311
    Thanks
    58
    Thanked 525 Times in 512 Posts
    Blog Entries
    5
    Quote Originally Posted by tempz View Post
    Where? No need to be rude also!
    I'm not being rude. I'm just stating a fact.


    Quote Originally Posted by tempz View Post
    Plus, I'm not reading what you guys have replied..
    In fact I owe you an apology because actually you were correct. I remembered the op asking about mysqli use but forget that he then went back and completely edited his entire post nullifying mine. I've got my wires crossed and continued thinking that he's using mysqli.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  6. #21
    New Coder
    Join Date
    Mar 2012
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you for everyone's help, I will try it out later ^^

    But, do you guys know how to solve this problem ? There is something wrong with my database mysql table. I posted in mysql thread.

    http://www.codingforums.com/showthre...02#post1304002

  7. #22
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    3,248
    Thanks
    12
    Thanked 340 Times in 336 Posts
    since the customer_display is not a simple string value (or similar), the SQL alone does not tell us if you made a mistake in the PHP code making that query.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


 
Page 2 of 2 FirstFirst 12

Posting Permissions

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