Jump to content

Enso

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Enso

  1. Hi ManiacDan, Thanks for your response. I just wanted to make sure I wasn't missing something before I started on this excursion, haha. Thanks again!
  2. Does anyone have any recommendations as to how to validate postal codes for all countries? I know how to do it for the US and Canada, but would I need to manually add cases for every other country based on their postal code format?
  3. Got it. And you were right, the COUNT was causing a return of rows regardless of whether or not it found any corresponding rows. I took that out and it now seems to be working. I never considered that. Thanks so much for your help!
  4. Hi Little Guy, The problem that I run into when I try the code you specified is that it seems to skip the validation piece and the site goes to the "account successfully created" page regardless of whether or not the account already exists. However, I did put a unique constraint on the username field in the database, so even though the website says a previously existing account has been successfully created again, the database does not write the row if the username already exists. I just can't get the logic to work properly on the website side. It seems to be all or nothing -- either the site accepts everything without the validation, or the validation pops up on every account created (though if it's an unused username, it still writes to the database even when the validation screen comes up).
  5. Hi Jessica, Right -- that's what I'm wanting to accomplish: if rows == 0, that username has already been created in the database; rows = anything above 0, perform the insert listed in the else statement. Am I writing it incorrectly in the code? Sorry if some of the questions seems silly...I'm pretty new at a lot of these concepts. Thanks for your help
  6. Hi All, I've been working on a piece of code to check for duplicate username records in a MySQL database. If there is already a username in the database that the user is trying to register with, it displays an error. If not, it writes a row with the person's information to the database. The problem is that, with the way I currently have it written, it is skipping the validation and trying to write to the database anyway. Here is what I have: $sql_query = "SELECT COUNT(*) from users WHERE username = '$uname'"; $result = mysql_query($sql_query); if(mysql_num_rows($result) == 0) { echo "<script>alert('Sorry, that username already exists. Please choose another.');history.back(-1);</script>"; } else{ $sql="INSERT INTO `users` (`fname`, `lname`, `email`, `username`, `password`, `insert_time`) VALUES ('$fname', '$lname', '$email', '$uname','$password' ,'$date')"; } I'm hoping maybe one of you can see something that I don't. Thanks!
  7. Thanks for all the help! Micah, thank you for your suggestion -- I tried the format that you provided, and it worked!
  8. I'm with you there. However, this is for a client, and they're pretty adamant about having it up. It's not *too* intrusive...it's just a 3-second welcome message. If it were me, there'd be no sound, but I have to go with the client's wishes.
  9. Hi Everyone, I'm trying to get an audio file to play on a home page once per visit, but the problem I'm running into is that it plays *every* time a visitor goes to the home page. So, if a user goes to the home page, the file plays; then, if they go to another page on the website and return to the home page, the file plays again. Is there any way to get it to only play once per web browser session?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.