Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Hi there,

I have a delete course button in a course and student page which passes to a delete record page. The data in the first page is displayed as follows using 2 "foreach" statements:

Student 1 Remove this Student

Course A Remove this Course Remove this Course Too

Course B Remove this Course Remove this Course Too

Course C Remove this Course Remove this Course Too

Student 2 Remove this Student

Course A Remove this Course Remove this Course Too

Course B Remove this Course Remove this Course Too

Course C Remove this Course Remove this Course Too

etc.

There are two different links I have been playing with. The first uses Course_ID and Usern_Name to identify the record for deletion. The variables get passed through the URL but the delete record does not happen.

The second link is called Remove This Course Too and is based on -recid instead of Course_ID and User_Name but I cant get it to pass the recid to the next script.

First Script

<?php

include_once('FX/FX.php');

include_once('FX/server_data.php');

$username_1 = $_POST['username'];

$password_1 = $_POST['password'];

$UN_Check=new FX($serverIP,$webCompanionPort,'FMPro7');

$UN_Check->SetDBData('Training_Account_Information.fp7','Training_Account_Information');

$UN_Check->SetDBPassword('fmsadmin','fmsadmin');

$UN_Check->AddDBParam('User_Name',$username_1, 'eq');

$UN_Check->AddDBParam('Password',$password_1, 'eq');

$UN_CheckResult=$UN_Check->FMFind();

$returnedCount=$UN_CheckResult['foundCount'];

if($returnedCount == 0 ) {

include 'login_account.php';

exit();

}

$UN_CheckData = current($UN_CheckResult['data']);

$Students=new FX($serverIP,$webCompanionPort,'FMPro7');

$Students->SetDBData('Training_Account_Information.fp7','Student_Information');

$Students->SetDBPassword('fmsadmin','fmsadmin');

$Students->AddDBParam('User_Name',$UN_CheckData['User_Name'][0], 'eq');

$StudentsResult=$Students->FMFind();

$returnedCount=$StudentsResult['foundCount'];

$Courses=new FX($serverIP,$webCompanionPort,'FMPro7');

$Courses->SetDBData('Training_Account_Information.fp7','Selected_Courses');

$Courses->SetDBPassword('fmsadmin','fmsadmin');

$Courses->AddDBParam('User_Name',$UN_CheckData['User_Name'][0], 'eq');

$CoursesResult=$Courses->FMFind();

$returnedCount=$CoursesResult['foundCount'];

?>

HTML etc

<?php foreach($StudentsResult['data'] as $row) { ?>

<?php echo $row['First_Name_1'][0]; ?>

<?php echo $row['Last_Name_1'][0]; ?>

Remove this Student

<?php foreach($CoursesResult['data'] as $row2) { ?><?php echo $row2['Course_Name'][0]; ?>

Remove this Course

Remove this Course Too

<?php } ?>

<?php } ?>

Second Script (note the commenting out of the recid code)

<?php

include_once('FX/FX.php');

include_once('FX/server_data.php');

$courseid = $_GET['courseid'];

$username = $_GET['username'];

/*$recid = $_GET['recid'];*/

$Search=new FX($serverIP,$webCompanionPort,'FMPro7');

$Search->SetDBData('Training_Account_Information.fp7','Selected_Courses');

$Search->SetDBPassword('fmsadmin','fmsadmin');

$Search->AddDBParam('Course_ID',$courseid, 'eq');

$Search->AddDBParam('User_Name',$username, 'eq');

/*$Search->AddDBParam('-recid',$recid, 'eq');*/

$SearchResult=$Search->FMDelete(true);

/*print_r($SearchResult);

exit(0);*/

include 'confirm_login.php';

?>

All advice gratefully received.

  • 4 weeks later...

Brainonastick,

Is your code actually rendering the recid on the row?

You could try adding the following to your foreach loop

$RecordKeys=explode('.',$key);      

$recid=$RecordKeys[0];

Then you need to change your reference to your recid on

Remove this Course Too

to

Remove this Course Too

Any time you edit or delete a record you must pass the -recid. So try that and check the source on your page to make sure the recid is visible on your a href delete link. And don't forget to uncomment your lines:

/*$recid = $_GET['recid'];*/

/*$Search->AddDBParam( '-recid',$recid, 'eq');*/

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.