Welcome Guest, Not a member yet? Register   Sign In
please hepl me.. about database..
#1

[eluser]fyzza[/eluser]
i have problem for connecting to database.. i just make simple form... but i was try 3 weeks to connect them.. can you help me? what is the problem?


model

<?php
class Welcome_model extends Model {

function Welcome_model()
{
parent::Model();
}

function addclient($client_data)
{
if ($this->db->insert('feedback', $client_data))
{
return TRUE;
}
else
{
return FALSE;
}
}
}

?>


view

<?php
$attributes = array ('class'=>'welcome_message', 'id'=>'feedback');
echo form_open('welcome_message', $attributes);?>
<table>
<tr>
<td valign="top"> Title: </td>
<td>&lt;input type="text" name="title" id="title" size="40" maxlength="30" /&gt;&lt;/td>
</tr>
<tr>
<td valign="top"> Name: </td>
<td>&lt;input type="text" name="name" id="name" size="40" maxlength="30" /&gt;&lt;/td>
</tr>
<tr>
<td valign="top"> Comments: </td>
<td>&lt;input type name="comments" id="comments" size="40" maxlength="30" /&gt;&lt;/td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&lt;input type="reset" name="reset" id="reset" value="Reset" /&gt;&lt;input type="submit" name="feedback" id="feedback" value="Submit" /></td>
</tr>
</table>
&lt;/form&gt;
<br/>


controller

&lt;?php

class Welcome extends Controller {

function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->view('welcome_message');
$this->load->model('welcome_model');
$this->load->helper('file','form','url');

function addclient($client_data)
{
$client_data = array(
'client_id' => $this->input->post('client_id'),
'title' => $this->input->post('title'),
'name' => $this->input->post('name'),
'comments' => $this->input->post('comments'),
);
$this->db->insert('feedback', $client_data);
}

}
}
?&gt;



1)$autoload['libraries'] = array('database');

2)Database

$active_group = "default";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "root";
$db['default']['password'] = "";
$db['default']['database'] = "feedback";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['active_r'] = TRUE;
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

?&gt;

3)$config['base_url'] = "http://localhost/testing/";


I hope you all can help me because i am a beginner.. i love to learn it.. thank you..


Messages In This Thread
please hepl me.. about database.. - by El Forum - 02-19-2009, 04:25 AM
please hepl me.. about database.. - by El Forum - 02-19-2009, 05:29 AM
please hepl me.. about database.. - by El Forum - 02-19-2009, 05:30 AM
please hepl me.. about database.. - by El Forum - 02-19-2009, 08:56 PM
please hepl me.. about database.. - by El Forum - 02-19-2009, 11:41 PM
please hepl me.. about database.. - by El Forum - 02-20-2009, 05:31 AM
please hepl me.. about database.. - by El Forum - 02-20-2009, 07:28 AM
please hepl me.. about database.. - by El Forum - 02-23-2009, 08:03 PM
please hepl me.. about database.. - by El Forum - 02-24-2009, 05:01 PM
please hepl me.. about database.. - by El Forum - 02-24-2009, 06:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB