Hejsa... jeg har et problem med et script jeg har.
jeg får følgene fejl meddelelse:
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 'WHERE =' AND =''' at line 1
koden ser sådan her ud: $raw = mysql_query("SELECT * FROM $this->table_name WHERE $this->table_username='$this->query_username' AND $this->table_password='$this->query_password'") or die(mysql_error());
$raw = mysql_query("SELECT * FROM ".$this->table_name." WHERE ".$this->table_username."='".$this->query_username."' AND ".$this->table_password."='$this->query_password."'") or die(mysql_error());
Og så kan du altid få den udskrevet så du kan se hvad den indeholder ved: echo ("SELECT * FROM ".$this->table_name." WHERE ".$this->table_username."='".$this->query_username."' AND ".$this->table_password."='$this->query_password."'";
$raw = mysql_query("SELECT * FROM ".$this->table_name." WHERE ".$this->table_username."='".$this->query_username."' AND ".$this->table_password."='".$this->query_password."'") or die(mysql_error());
får stadig 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 'WHERE ='' AND =''' at line 1
$redirect_accepted = "test.php"; // redirects to this if login is succesful $redirect_denied = "test2.php"; // redirects to this if login has been denied
/* create class */ $a = new login($mysql_database,$mysql_hostname,$mysql_username,$mysql_password,$query_username,$query_password,$table_name,$table_username,$table_password,$redirect_accepted,$redirect_denied);
$a->login_mysql(); $a->login_check();
}
og her medfølger min class
class login {
/* construct */ function __construct($my_database,$my_host,$my_username,$my_password,$query_username,$query_password,$table_name,$table_username,$table_password,$redirect_accept,$redirect_denied) {
$raw = mysql_query("SELECT * FROM ".$this->table_name." WHERE ".$this->table_username."='".$this->query_username."' AND ".$this->table_password."='".$this->query_password."'") or die(mysql_error()); $check = mysql_fetch_row($raw);
session_start();
if ($check[0] != "") { $_SESSION['loggedin'] = 1; if ($this->redirect_accept) header("Location: $this->redirect_accept"); } else { $_SESSION['loggedin'] = 0; if ($this->redirect_denied) header("Location: $this->redirect_denied"); }
Umiddelbart kan jeg ikke se nogen fejl, men de er altså tomme... Måske det kan stamme helt tilbage til, at $_POST['password'] er tom?
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.