Forums

Here are my Debugger results for DB Read....

swmckay 15 Apr, 2015
Hello,

I am trying to allow my registered/logged in users to view and edit their career profiles (each user only gets to save one career profile) that they have previously saved in a table using a V5 form. This worked perfectly in V4 using a hidden field (cf_id) and this WHERE statement:

<?php $user =& JFactory::getUser();
$form->data['user_id'] = $user->id;?>  


Alas, I can't figure out how to pull/edit/save existing records in V5. I have fiddled with this FAQ below but still no luck.

https://www.chronoengine.com/faqs/72-ccv5/5215-how-do-i-build-a-where-statement-in-ccv5.html

Any assistance would be a life saver!

Here is the order of things:

DESIGNER:

HIDDEN FIELD (with cf_id)

SETUP:

1. DB READ
[list]Multi Read=Yes
Enable Model ID=No
Model ID= empty
Fields=cf_id
Order=empty
Group=empty
Conditions=tried several things, currently blank[/list]


2. HTML RENDER

3. DEBUGGER

Here are the latest debugger results...



Data Array
Array
(
    [id] => 89
    [careerprofilebuild] => 
    [0] => Array
        (
            [cf_id] => 79
        )

)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
    [2] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `Data`.`cf_id` AS `Data.cf_id` FROM `j16_chronoforms_data_careerprofile` AS `Data`
                        )

                )

        )

)


Any assistance would be sincerely appreciated!
GreyHead 15 Apr, 2015
Hi swmckay,

Please try this in the Conditions box:
<?php
$user = JFactory::getUser();
return array( 'user_id' => $user->id);
?> 

Bob
swmckay 19 Apr, 2015
Hi Bob,

I added in the code below in DB Read/Conditions. It did not call the existing record as it should. In fact instead if updating the record it added a second one. Here is the code I added and the debugger results. Not sure what the results mean. Any ideas on how to fix it?

<?php
$user = JFactory::getUser();
?>
return array( 'user_id' => $user->id);
?> 


return array( 'user_id' => $user->id); ?>
Data Array
Array
(
    [id] => 89
    [careerprofilebuild] => 
    [0] => Array
        (
            [cf_id] => 79
        )

)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
    [2] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `Data`.`cf_id` AS `Data.cf_id` FROM `j16_chronoforms_data_careerprofile` AS `Data`
                        )

                )

        )

)
GreyHead 19 Apr, 2015
Hi swmckay,

It looks as though you may have an extra ?> in your code?

Bob
This topic is locked and no more replies can be posted.