|
|
|
ช่วยดูให้หน่อยครับมันบอกว่า error array ครับๆๆๆๆๆๆๆๆๆๆๆๆ |
|
|
|
|
|
|
|
Code (PHP)
<?php
if(isset($_POST['submit'])){
$db = new mysqli('localhost', 'root', '1234', 'social') or die('error');
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$userCheck = $db->query("SELECT social FROM account WHERE username='".$username."'");
if(empty($fname) || empty($lname) || empty($username) || empty($password) || empty($email)){
if(empty($fname)){
$errors[] = "Miss Fname";
}
if(empty($lname)){
$errors[] = "Miss Lname";
}
if(empty($username)){
$errors[] = "Miss Username";
}
if(empty($password)){
$errors[] = "Miss Password";
}
if(empty($email)){
$errors[] = "Miss Email";
}
}else if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
$errors[] = "Not a caild email";
}else if($username == $password){
$errors[] = "Username & password can't match";
}else if($userCheck->num_rows>0){
$errors = "username is already in use";
}else{
$fname = strip_tags($fname);
$fname = stripcslashes($fname);
$fname = trim($fname);
$lname = strip_tags($lname);
$lname = stripcslashes($lname);
$lname = trim($lname);
$username = strip_tags($username);
$username = stripcslashes($username);
$username = trim($username);
$password = strip_tags($password);
$password = stripcslashes($password);
$password = trim($password);
$password = md5($password);
$email = strip_tags($email);
$email = stripcslashes($email);
$email = trim($email);
$sql = "INSERT INTO account (firs_name, last_name, username, password, email) VALUES(?,?,?,?,?)";
if($query = $db->prepare($sql)){
$query->bind_param($fname,$lname,$username,$password,$email);
$query->execute();
$msg = "Your account has been created";
}else{
$errors[] = "Sorry error with database at this time";
}
}
}
?>
Tag : PHP
|
|
|
|
|
|
Date :
2013-01-22 20:57:26 |
By :
nukedonut1 |
View :
790 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Error อะไรครับ ???
|
|
|
|
|
Date :
2013-01-22 21:18:07 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไหน array() ??
|
|
|
|
|
Date :
2013-01-22 21:22:01 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มองไม่เห็น ปัญหา
|
|
|
|
|
Date :
2013-01-22 21:36:57 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|