aneesahmadweb@gmail.com     03040836207

    Lets say we have a table review and need to update a record there.I will add the date of a review.

    $created_at = $this->getRequest()->getParam('created_at');
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager
    $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
    $connection = $resource->getConnection();
    $tableName = $resource->getTableName('review');
    
    $sql= "Update  $tableName Set created_at = '$created_at' where review_id = $reviewId";
    
    $connection->query($sql);

    About Author

    You may also like

    No Comment

    You can post first response comment.

    Leave A Comment

    Please enter your name. Please enter an valid email address. Please enter a message.