Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Retrieving Data Through Code Igniter
Old 08-15-2008, 11:50 AM Retrieving Data Through Code Igniter
Experienced Talker

Posts: 34
Trades: 0
Hi

Iam new to code igniter technique. Got a problem relating to retrieving fields from database.

According to the logic, I query database for desired/selected field results and send them to any page view. In a normal way the array of results ,have same names as database field names. So printing the array as $row->Name(field). In a way its working fine,but....

The problem is that, when any field is empty , its gives error Undefined index
autumn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2008, 12:20 PM Re: Retrieving Data Through Code Igniter
Extreme Talker

Posts: 177
Trades: 0
Can you post more code so we can get a better idea of what's happening?

But from what you gave....field should probably have a $ sign...unless it's a constant, and you should probably do constant("field");
kbfirebreather is offline
Reply With Quote
View Public Profile
 
Old 08-15-2008, 11:14 PM Re: Retrieving Data Through Code Igniter
Experienced Talker

Posts: 34
Trades: 0
The coding is simple, I mentioned field, just to specify that Name is field of table.

The model code is

data_query (model name) and function fetch_profile($id):

$this->db->select('*')->where('Id',$id)->from('location');
$query = $this->db->get()->row_array();

return $query;

The controller code is

$this->load->model('data_query');
$page['result'] = $this->data_query->fetch_profile($id);

$this->load->view('Profile',$page);

And displaying the result

echo $result['Name'];
echo $result['Address']; etc etc

Its working fine, if the fields are not empty ,but gives error (undefined index) for empty field. Kindly need a solution.
autumn is offline
Reply With Quote
View Public Profile
 
Old 08-16-2008, 03:16 AM Re: Retrieving Data Through Code Igniter
Experienced Talker

Posts: 34
Trades: 0
Got it cleared.

Thanks, anyway.
autumn is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Retrieving Data Through Code Igniter
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13368 seconds with 12 queries