PHP Require_once and after that call a function

98 Views Asked by At

2 files: resetMyEvent.php and resetEvent.php

In resetMyEvent.php I need to do a require_once for resetEvent.php

path: admin/resetMyEvent.php

and

path: room/server/updateUserInfo/resetEvent.php

1.First question: get error at require_once because the path is not good, why?

2.Second question: and after that how do i call the function in resetEvent.php in require_once with a parameter from try?

--> the parameter is $currentRoom['eventID'];

This is the the code from resetMyEvent.php:

<?php
require_once('security.php');
require_once('../room/server/db/db.php');

//Here is my require 
require_once('../room/server/updateUserInfo/resetEvent.php');

try {
    // Get this subdomain's currentRoom eventId
    $sql = $dbPDO->prepare("SELECT `coupleEventId` AS `eventId` FROM currentRooms WHERE `serverName`=?");
    $sql->execute([$_SERVER['SERVER_NAME']]);
    $currentRoom = $sql->fetch();
    // Set eventEnd for this eventId back to NULL
    $sql = $dbPDO->prepare("UPDATE couple_events SET `cplEv_eventEnd`=NULL WHERE `cplEv_Id`=?");
    $sql->execute([$currentRoom['eventId']]);
    ////////////////this is the parameter $currentRoom['eventId']
    echo 'Reset eventEnd for Event '.$currentRoom['eventId'];
} catch (PDOException $e) {
    echo $e;
}

Thank you!

0

There are 0 best solutions below