<?php header("Access-Control-Allow-Origin: *"); $ecodedata = $_POST["postdata"]; // echo "server say::".($ecodedata); //base64_decode $b= json_decode ($ecodedata); $v= $b->v; $w= $b->w; // $x= $b->x; // $y= $b->y; // $z= $b->z; require_once "configs.php"; //check data $sql='SELECT * FROM fixa where title="'.$v.'"'; $res = $db->query($sql); $i=0; while ($row = $res->fetchArray()) { echo "{$row['username']}"; $i++; } if ($i>0) $have=$i; //echo "we have=$have="; if ($have) { echo "Sorry:[$v] already taken";exit;} else { //echo $v.$w; $vv=$v; // echo "start create user $x $y $code $company $v $z"; // $sql = "INSERT INTO fixa (username, email, code, password,company,businesstype) VALUES (?, ? ,?,?,?,?)"; $stmt = $db->prepare("INSERT INTO fixa(title,title_th,scode) VALUES (?,?,?)"); $stmt->bindParam(1,$v); //$stmt = $db->prepare("INSERT INTO users (username,email,code,password,company,businesstype) VALUES (?,?,?,?,?,?)"); $stmt->bindParam(2,$vv); $stmt->bindParam(3,$w); //$stmt->bindParam(3,$w); $stmt->execute(); if ($db==FALSE) echo "Error in fetch ".$db->lastErrorMsg(); //echo "done $x $have"; echo "OK"; //$db->close(); } ?>
Edit file:sq_ifixa.php1392