The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DB Update - Not working (that's the way it seems)
#1
I am new to UserSpice, and I have recently started working with another group on a project that has been developed using UserSpice.

There is an issue we have encountered where an entry can be edited but when performing the DB Update, the record is not updated.

I'm still learning the framework and I can see the DB.php file and the functions, and it seems to me the db->update should work but I'm not sure why it does not.

From the following can anyone glean why it would not update?

Thanks for any assistance anyone can provide.

?>
<?php require_once '../users/init.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/header.php'; ?>
<?php require_once $abs_us_root.$us_url_root.'users/includes/navigation.php'; ?>

<?php if (!securePage($_SERVER['PHP_SELF'])){die();} ?>
<?php
$validation = new Validate();
//PHP Goes Here!
$errors = [];
$successes = [];
$rtuId = Input::get('id');

//Check if selected user exists
if(!rtuIdExists($rtuId)){
  Redirect::to("company_admin_rtus.php"); die();
}
$rtudetails = fetchRTUDetails(NULL, NULL, $rtuId); //Fetch rtu details

$str = $rtudetails->org_id;
$str .= $rtudetails->rtu_id;

//Forms posted
if(!empty($_POST)) {
    $token = $_POST['csrf'];
    if(!Token::check($token)){
      die('Token doesn\'t match!');
    }else {

      //set changed bit in database
      $configchanged=array(

              'configChange' => 1,
            );

    //Update rtu name

    if ($rtudetails->rtu_name != $_POST['rtu_name']){
      $rtu_name = Input::get("rtu_name");
      $fields=array('rtu_name'=>$rtu_name);
      $validation->check($_POST,array(
        'rtu_name' => array(
          'display' => 'rtu_name',
          'required' => true,
          'min' => 1,
          'max' => 50
        )
      ));
    if($validation->passed()){
      $db->update('rtu_act', $rtuId, $fields);
      $successes[] = "RTU Name Updated";
    }else{
          ?><div id="form-errors">
            <?=$validation->display_errors();?></div>
            <?php
      }
    }
  Reply


Messages In This Thread
DB Update - Not working (that's the way it seems) - by rob@selectech.us - 02-14-2019, 01:58 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)