Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL]Problem z rejestracja
edwarpan
post
Post #1





Grupa: Zarejestrowani
Postów: 66
Pomógł: 0
Dołączył: 28.04.2010

Ostrzeżenie: (0%)
-----


Witam, posiadam skrypt:
  1. <?php
  2.  
  3. if (isset($_POST['submit'])) { // if form has been submitted
  4.  
  5. /* check they filled in what they supposed to,
  6.  
  7. passwords matched, username
  8.  
  9. isn't already taken, etc. */
  10.  
  11. if (!$_POST['uname'] || !$_POST['passwd'] ||
  12.  
  13. !$_POST['passwd_again'] || !$_POST['email']) {
  14.  
  15. die('You did not fill in a required field.');
  16.  
  17. }
  18.  
  19. //validate the inputs
  20.  
  21. $_POST['uname'] = safe($_POST['uname']);
  22.  
  23. $_POST['passwd'] = safe($_POST['passwd']);
  24.  
  25. $_POST['email'] = safe($_POST['email']);
  26.  
  27. $_POST['tele'] = safe($_POST['tele']);
  28.  
  29. $_POST['gg'] = safe($_POST['gg']);
  30.  
  31. // check if username exists in database.
  32.  
  33. $qry = "SELECT 'username' FROM 'users' WHERE 'username' = '".$_POST['uname']."'";
  34.  
  35. $sqlmembers = mysql_query($qry) or die(mysql_error()) ;
  36.  
  37. $name_check = mysql_fetch_array ($sqlmembers);
  38.  
  39. $name_checkk = mysql_num_rows ($sqlmembers);
  40.  
  41. if ($name_checkk != 0) {
  42.  
  43. die('Sorry, the username: <strong>'.$_POST['uname'].'</strong>'
  44.  
  45. . ' is already taken, please pick another one.');
  46.  
  47. }



Wywala błąd:
  1. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''users' WHERE 'username' = 'test'' at line 1

Już sam nie wiem, nie można usunąć, ponieważ jak dobrze rozumiem wtedy by można kilka razy rejestrować ten sam login. Proszę o pomoc.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 09:16