Question :
i need to show all the details for the particular user id in the
profiles view page i can get the array value in the view page i parse
the array and display the records but i can ot able to o in the edit
page please help me to finish.
please refer the following code.. and any thing need to correct please
correct it ...
i have 4 tables 1. profiles 2.scientifics 3.professionals
4 .contacts
=================================================================
Table structure
1. profiles
id int(11) ,username varchar(255) ,password varchar(255)
,title varchar(255)
the bellow records are having more then one record's for the
particular user id.
2.scientifics
id int(11) ,userid int(11) ----> this is from the profile
table's id
orgname varchar(255) qualification varchar(255)
3.professionals
id int(11) ,userid int(11) ----> this is from the profile
table's
company varchar(255)
4 .contacts
id int(11) userid int(11) contact_type
enum('business', 'private')
street varchar(255)
================================================================
Question :
i need to show all the details for the particular user id in the
profiles view page i can get the array value in the view page i parse
the array and display the records but i can ot able to o in the edit
page please help me to finish.
please refer the following code.. and any thing need to correct please
correct it ...
url:
localhost/damu/profiles/edit
Profiles Controller :
================================================
function index()
{
$this->Profile->id = 1;
$this->set('data', $this->Profile->read());
$pcondition = "WHERE contact_type = 'private'";
$this->set('private',$this->Profile->Contact->find($pcondition));
$pcondition = "WHERE contact_type = 'business'";
$this->set('business',$this->Profile->Contact->find());
}
=========================================
Profile Model
````````````````````
var $name = 'Profile';
var $hasMany =
array('Professional'=>array('className'=>'Professional','foreignKey'
=>
'userid'),'Scientific'=>array('className'=>'Scientific','foreignKey'
=> 'userid'),'Contact'=>array('className'=>'Contact','foreignKey' =>
'userid'));
Professional Model:
````````````````````````````
var $name = 'Professional';
var $belongsTo =
array('Profile'=>array('className'=>'Profile','foreignKey' =>
'userid'));
Scientific Model:
``````````````````````````
var $name = 'Scientific';
var $belongsTo =
array('Profile'=>array('className'=>'Profile','foreignKey' =>
'userid'));
====================================================================
View for the Index page:
`````````````````````````````````````
index.thtml
for profile table display
````````````````````````````````````
<?php echo $data['Profile']['firstname'].$data['Profile']['lastname']?
>
for professional table display
`````````````````````````````````````````
if($data['Professional'])
{
foreach ($data['Professional'] as $professional)
{
<?php echo $professional['company'] ?>
}
}
for scientific table display
``````````````````````````````````````
if($data['Scientific'])
{
foreach ($data['Scientific'] as $scientific)
{<?php echo $scientific['orgname']?>}}
for contact business :
``````````````````````````````
<?php echo $business['Contact']['street'].
for contact private:
`````````````````````````
<?php echo $private['Contact']['street'].
===========================================================
EDIT PAGE :
Profile controller:
function edit()
{
// i use the same for the index to show the edit form text box with
particular value, then i write the extra one line to
$this->set(compact('profiles', 'scientifics', 'professionals',
'contacts'));
}
o/p: i get the same array (indexpage array ) how can i put into text
box .. and how can i save the data and what are the things i need to
write the controller:
please help me to find the solution .. this is the correct way ..my
code??.......... i dont know am beginner to cake php.
in the view page i wrote like :
print_r($data);
//die();
echo $data->input('id');
die();
but its not working ..........
and this bellow line is aslo not working ............
<?php echo $html->input('Profile/title', array('size' => '25')); ?>
please help me to solve the issue
than you
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment