whiteboikyle Posted August 10, 2011 Share Posted August 10, 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. Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/ Share on other sites More sharing options...
Morg. Posted August 10, 2011 Share Posted August 10, 2011 You might want to include the code generating the "1 is blank" and stuff because this is quite cryptic right now -- Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/#findComment-1255338 Share on other sites More sharing options...
whiteboikyle Posted August 10, 2011 Author Share Posted August 10, 2011 That is the problem its submitting a blank sql to the database and i have no clue why Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/#findComment-1255516 Share on other sites More sharing options...
whiteboikyle Posted August 10, 2011 Author Share Posted August 10, 2011 bump Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/#findComment-1255575 Share on other sites More sharing options...
Maq Posted August 10, 2011 Share Posted August 10, 2011 whiteboi, DO NOT double post, you should know better. I locked your other thread: http://www.phpfreaks.com/forums/index.php/topic,341078.0.html Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/#findComment-1255577 Share on other sites More sharing options...
whiteboikyle Posted August 10, 2011 Author Share Posted August 10, 2011 Sorry was originally posted in the framework (which is what im using) but it seems to lack people in that thread so i posted over here. Quote Link to comment https://forums.phpfreaks.com/topic/244376-duplicate-entries-in-sql-ci/#findComment-1255587 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.