android - Php webservice inserting data to a database -
in authentication.php class hava code below;
public function prepareticket($data){ if(array_key_exists('tickettype', $data)) $this->tickettype = $data['tickettype']; if(array_key_exists('ticketinfo', $data)) $this->ticketinfo = $data['ticketinfo']; } function createticket(){ $sql = "insert ticket_test (tickettype, ticketinfo) values ('$this->tickettype','$this->ticketinfo')"; $result = mysqli_query($this->db_connection,$sql); } function createticketcontrol(){ $sql = "select * `ticket_test` tickettype = '".$this->tickettype."'and ticketinfo ='".$this->ticketinfo."'"; $result = mysqli_query($this->db_connection,$sql); if(mysqli_num_rows($result) >0){ return true; }else{ return false; } } and in other php file have code this;
<?php include_once 'authentication.php'; use user\authentication; $auth = new authentication(); $auth->prepareticket($_post); $ticketstatus = $auth->createticketcontrol(); if($ticketstatus){ $json['success'] = 1; $json['message'] = 'destek kaydı oluşturuldu'; }else{ $json['success'] = 0; $json['message'] = 'error!'; } echo json_encode($json); now problem whenever try insert data database returns 'success' = '0' , 'message' = 'error' , data couldnt inserted on database.i mean service not working properly.any appreciated...
p.s.= aware of sql injection threat on code bu android app no need worry it.
found solution.i realised in createticket.php didint call createticket function authentication.php :/
Comments
Post a Comment