Welcome Guest, Not a member yet? Register   Sign In
Duplicate SQL insert

friendRequest.php view file
<div id="friendRequestForm">
<legend>Friend Request: &lt;?=$this->get_user->getName($segment);?&gt;</legend>
&lt;?=form_textarea('message', 'Message', 'id="messageArea" rows="1" cols="20"');?&gt;
&lt;?=form_hidden('userID', $this->uri->segment(3)); ?&gt;
&lt;?=form_submit('submit', 'Send Request', 'class="buttons"'); ?&gt;

friends.php Construct
function addFriend(){
        if($query = $this->user_friends->sendRequest()){
            $data['message'] = 'Your friend request has been submitted please wait for the user to accept you!';
            $data['main_content'] = 'display';
            $this->load->view('include/template.php', $data);    
        else {
            $data['message'] = 'An error has accurd';
            $data['main_content'] = 'display';
            $this->load->view('include/template.php', $data);


user_friends model
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class user_friends extends CI_Model {
    function acceptFriend(){
    function denyFriend(){

    function sendRequest(){
        $new_member_insert_data = array(
            'toUserID' => $this->input->post('userID'),
            'fromUserID' => $this->session->userdata('userID'),
            'type' => 'friendRequest',
            'text' => $this->input->post('message')
        $insert  = $this->db->insert('notification', $new_member_insert_data);
        return $insert;

im getting a duplicate entry to the SQL when i send request
1 is blank
1 is correct info.

i dono where the second blank entry is comming from

Theme © iAndrew 2016 - Forum software by © MyBB