I tried something already written in the topics but it didin't worked I got SQLSTATE[HY093]: here is my codes;
<?php
include '
black/netting/islem.php';
$user = new USER();
if($user->is_loggedin()!="")
{
$user->redirect('home.php');
}
?>
islem.php ;
<?php
function tckimlik($tcno) {
$olmaz=array('11111111110','22222222220','33333333330','44444444440','55555555550','66666666660','7777777770','88888888880','99999999990');
if($tckimlik[0]==0 or !ctype_digit($tckimlik) or strlen($tckimlik)!=11){ return false; }
else{
for($a=0;$a<9;$a=$a+2){ $ilkt=$ilkt+$tckimlik[$a]; }
for($a=1;$a<9;$a=$a+2){ $sont=$sont+$tckimlik[$a]; }
for($a=0;$a<10;$a=$a+1){ $tumt=$tumt+$tckimlik[$a]; }
if(($ilkt*7-$sont)%10!=$tckimlik[9] or $tumt%10!=$tckimlik[10]){ return false; }
else{
foreach($olmaz as $olurmu){ if($tckimlik==$olurmu){ return false; } }
return true;
}
}
}
if(isset($_POST['tcsorgula']))
{
$tcno = strip_tags($_POST['tcno']);
$tel_no = strip_tags($_POST['tel_no']);
$mail = strip_tags($_POST['mail']);
$forum_name = strip_tags($_POST['forum_name']);
$uye_sifre = strip_tags($_POST['uye_sifre']);
$type = strip_tags($_POST['type']);
$first_name = strip_tags($_POST['first_name']);
$last_name = strip_tags($_POST['last_name']);
$gender = strip_tags($_POST['gender']);
$user_birth = strip_tags($_POST['user_birth']);
if(!filter_var($mail, FILTER_VALIDATE_EMAIL)) {
$error[] = 'Lütfen geçerli bir e-mail adresi giriniz!';
}
else if(strlen($uye_sifre) < 6){
$error[] = "Şifreniz en az 6 karakterden oluşmalıdır";
}
else if($uye_sifre!=$sifre_tekrar) {
$error[] = "Lütfen şifrenizi tekrar doğru giriniz";
}
else if (isset($_POST['tcsorgula'])) {
if(tckimlik($_POST['tcno'])){
} else {
echo "tc kimlik no sorunlu";
}
}
}
else {
try
{
$stmt = $user->runQuery("SELECT user_tcno, user_tel, user_email, user_fname FROM users WHERE user_tcno=:tcno OR user_tel=:tel_no OR user_email=:mail OR user_fname=:forum_name");
$stmt->execute(array(':uname'=>$tcno, ':umail'=>$mail));
$row=$stmt->fetch(PDO::FETCH_ASSOC);
if($row['user_fname']==$forum_name) {
$error[] = "Üzgünüz forum kullanıcı adı alındı !";
}
else if($row['user_tel']==$tel_no) {
$error[] = "Bu telefon numarası kayfı bulunmaktadır lütfen farklı bir telefon numarası giriniz...";
}
else if($row['user_email']==$mail) {
$error[] = "Bu e-mail kayfı bulunmaktadır lütfen farklı bir e-mail adresi giriniz...";
}
else if($row['user_tcno']==$tcno) {
$error[] = "Bu T.C kimlik numarası kaydı bulunmaktadır lütfen farklı bir T.C kimlik numarası giriniz...";
}
else
{
if($user->register($first_name,$last_name,$tcno,$tel_no,$mail,$uye_sifre,$gender,$user_birth,$forum_name,$type)){
$user->redirect('kayit.php?joined');
}
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
}
?>
<?php
require_once('dbconfig.php');
class USER
{
private $conn;
public function __construct()
{
$database = new Database();
$db = $database->dbConnection();
$this->conn = $db;
}
public function runQuery($sql)
{
$stmt = $this->conn->prepare($sql);
return $stmt;
}
public function register($first_name,$last_name,$tcno,$tel_no,$mail,$uye_sifre,$gender,$user_birth,$forum_name,$type)
{
try
{
$new_password = password_hash($uye_sifre, PASSWORD_DEFAULT);
$stmt = $this->conn->prepare("INSERT INTO users(user_name,user_sirname,user_tcno,user_tel,user_email,user_pass,user_gender,user_birthd,user_fname,user_type)
VALUES(:user_name, :user_sirname, :user_tcno, :user_tel, :user_email, :new_password, :user_gender, :user_birthd, :forum_name, :user_type)");
$stmt->bindparam(":user_name", $first_name);
$stmt->bindparam(":user_sirname", $last_name);
$stmt->bindparam(":user_tcno", $tcno);
$stmt->bindparam(":user_tel", $tel_no);
$stmt->bindparam(":user_email", $mail);
$stmt->bindparam(":user_fname", $forum_name);
$stmt->bindparam(":user_gender", $gender);
$stmt->bindparam(":user_birthd", $user_birth);
$stmt->bindparam(":user_type", $type);
$stmt->bindparam(":new_password", $new_password);
$stmt->execute();
return $stmt;
}
catch (PDOException $e)
{
echo $e->getMessage();
}
} ?>
then I got
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens
The error is showing because your parameter isn't serialized properly & your parameter number invalid. Your current parameters are :
first check this:
$stmt = $user->runQuery("SELECT user_tcno, user_tel, user_email, user_fname FROM users WHERE user_tcno=:tcno OR user_tel=:tel_no OR user_email=:mail OR user_fname=:forum_name");
$stmt->execute(array(':uname'=>$tcno, ':umail'=>$mail));
Change this to this way:
$stmt = $user->runQuery("SELECT user_tcno, user_tel, user_email, user_fname FROM users WHERE user_tcno=:tcno OR user_tel=:tel_no OR user_email=:mail OR user_fname=:forum_name");
$stmt->execute(array(':tcno'=>$tcno, ':tel_no'=> $telNo, ':mail' => $mail, ':forum_name' => $forumName));
and now here:
$stmt->bindparam(":user_name", $first_name);
$stmt->bindparam(":user_sirname", $last_name);
$stmt->bindparam(":user_tcno", $tcno);
$stmt->bindparam(":user_tel", $tel_no);
$stmt->bindparam(":user_email", $mail);
$stmt->bindparam(":user_fname", $forum_name);
$stmt->bindparam(":user_gender", $gender);
$stmt->bindparam(":user_birthd", $user_birth);
$stmt->bindparam(":user_type", $type);
$stmt->bindparam(":new_password", $new_password);
You have to change them as like this:
$stmt->bindparam(":user_name", $first_name);
$stmt->bindparam(":user_sirname", $last_name);
$stmt->bindparam(":user_tcno", $tcno);
$stmt->bindparam(":user_tel", $tel_no);
$stmt->bindparam(":user_email", $mail);
$stmt->bindparam(":new_password", $new_password);
$stmt->bindparam(":user_fname", $forum_name);
$stmt->bindparam(":user_gender", $gender);
$stmt->bindparam(":user_birthd", $user_birth);
$stmt->bindparam(":user_type", $type);
Now hopes this error will go away.
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
I am trying to create a table with a named constrained, however it is not being createdI tracked the problem to be in this line:
So I've got the following function to add a barcode field in the Product Inventory tabHowever this field is being added after all the other content, and I would like to have this before the SKU code
I'm trying to create an specific class to manage common database functionsThis class looks like this:
how to insert value into column of existing table like