whiteboikyle Posted August 9, 2011 Share Posted August 9, 2011 friendRequest.php view file <div id="friendRequestForm"> <fieldset> <legend>Friend Request: <?=$this->get_user->getName($segment);?></legend> <?=form_open('friends/addFriend');?> <?=form_textarea('message', 'Message', 'id="messageArea" rows="1" cols="20"');?> <?=form_hidden('userID', $this->uri->segment(3)); ?> <?=form_submit('submit', 'Send Request', 'class="buttons"'); ?> <?=form_close();?> </fieldset> </div> friends.php Construct function addFriend(){ $this->load->model('user_friends'); 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 <?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. Link to comment https://forums.phpfreaks.com/topic/244364-duplicate-sql-insert/ Share on other sites More sharing options...
whiteboikyle Posted August 10, 2011 Author Share Posted August 10, 2011 bump Link to comment https://forums.phpfreaks.com/topic/244364-duplicate-sql-insert/#findComment-1255572 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 Don't double post. I'm locking this. Link to comment https://forums.phpfreaks.com/topic/244364-duplicate-sql-insert/#findComment-1255576 Share on other sites More sharing options...
Recommended Posts