Forums

Delete record on list

latifa88 26 Aug, 2014
Hello ,

i meet stuff to delete record on list with chronoforms V4,

i have form which containts DB multi loader the data are displaying in table all rows have two submit link "edit "- "delete".also it containts an other form with input text to create a new record

i'v used hidden fields to edit and modify the record, it works good.

to delete record i'v used this url in the column
<td style="border-bottom:1px solid #CCCCCC;">
<a href="index.php?option=com_chronoforms&task=del_record&cf_id=<?php echo $etat['cf_id'];?>">delete</a>
</td>


del_record is the forms which containts code to delete:

<?php
$task = JRequest::getString('task', '', 'get');
if ( $task = 'del_record' ) {
$cf_id = = JRequest::getInt('cf_id', '', 'get');
if ( $cf_id 0 {
$db =& JFactory::getDBO();
$query = "
DELETE
FROM `perso_etat_commande`
WHERE `cf_id` = '{$cf_id}' ;
";
$db->setQuery($query);
$db->query();
}
}
$mainframe =& JFactory::getApplication();
$mainframe->redirect('index.php');
?>


please explain how should i do .

i want to pass the cf_id from the url to del_record

is the url correct?

best regards

latifa
GreyHead 26 Aug, 2014
HI latifa,

I have already told you more than once that there are serious errors in the PHP that you are using. Until you correct these there is little point in re-posting the same broken code.

I also don't understand where $etat comes from or what task=del_record does in the URL. That looks like a mixture of a ChronoForms and a ChronoConnectivity URL.

Bob
latifa88 26 Aug, 2014
hi Bob ,
$etat is form->data[table] ,

i'v found this php code in this forum i don't master PHP am just begginer ,
how should my code be ? can u explain me how can i delete record on my list please.

thanks Bob

CDT
Max_admin 27 Aug, 2014
Hi,

I think that everything should work ok as long as this piece returns the row's id:
<?php echo $etat['cf_id'];?>

And this depends on the main list, the variable $etat is not defined here.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
latifa88 27 Aug, 2014
Hello Max,

Thx a lot for reply,

i'v defined $etat on the form which containts list of record on the DB multirecord loader i'v made $form->['table_name'] as $etat

Max is the URL correct <a href="index.php?option=com_chronoforms&task=del_record&cf_id=<?php echo $etat['cf_id'];?>


best regards
GreyHead 27 Aug, 2014
Hi latifa,

I'm repeating myself again, if you want help here please listen to it.
These three lines are all broken and will not work
if ( $task = 'del_record' ) {
$cf_id = = JRequest::getInt('cf_id', '', 'get');
if ( $cf_id 0 {

Bob
Max_admin 27 Aug, 2014
Anyway the line of code with $etat must be returning some value, if it doesn't then don't expect the next step to work correctly, assuming the code is correct.

And it looks like I didn't check your code well earlier, Bob has found some error which need to be fixed, here is a fixed version for the 3 lines:

if ( $task == 'del_record' ) {
$cf_id = JRequest::getInt('cf_id', '', 'get');
if ( $cf_id ) {


Actually where did you place this code ? you should have received a PHP syntax error!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
latifa88 27 Aug, 2014
hello,

tanks so much for your help

i'v fixed my code and it still doesn't work , is there any setting to do ?

CDT
Max_admin 28 Aug, 2014
I suggest using ChronoConnectivity v5 for CRUD operations.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.