A PHP Error was encountered

Severity: Warning

Message: fopen(/var/lib/php/sessions/ci_session1675012f121658f4c6d656e73dd67d2a71df3e14): failed to open stream: No space left on device

Filename: drivers/Session_files_driver.php

Line Number: 156

Backtrace:

File: /var/www/prijm.com/public/application/core/Prijom_Controller.php
Line: 6
Function: __construct

File: /var/www/prijm.com/public/application/controllers/Discussion.php
Line: 11
Function: __construct

File: /var/www/prijm.com/public/index.php
Line: 292
Function: require_once

Update and Delete data in Mongo DB using php

join the prijm community

prijm is a community of people, just like you helping each other.
join them, it only takes a minute :)

Update and Delete data in Mongo DB using php

https://www.youtube.com/watch?v=3MTKZgYx3a0

Insert data in MongoDB using PHP - Part 2

I want the Data to be updated and Deleted in Mongo DB using php and the code of update & Delete should be on same page

1 0
1 reply and 0 comment

Hi @bhisha18

Sorry for late reply and not being able to upload rest of the video. If you have followed my tutorial then you are going to have a class, so start from there. As the reference here is the MongoDB update documentation. 

To update at first you need to query for the document that you want to update. For example we want to update the user whose name is "Andy", we want update it to "Mark Andy". So the code would be like this: (Add this method to the MongodbDatabase.php file)

public function update( $find, $updateable ){
    $this->db->update( $find, $updateable );
}

Now, to update the value we would call this method from any php file where you have instantiated this class, like this:

    $db->update(
        [ 'name' => 'Andy' ],
        [ 'name' => 'Mark Andy' ],
    );

Please note that i didnt tested this code, but i hope it would work, let me know if something breaks.

please login or signup to reply
post a reply
discussion resolution do more with this discussion
followed by 1 user added by 0 user save this discussion to reply later make this discussion anonymous
discussion stats
views: 1252
replies: 1
favorites: 0
follower: 1
saved: 0
comments: 0

A PHP Error was encountered

Severity: Warning

Message: rewind() expects parameter 1 to be resource, boolean given

Filename: drivers/Session_files_driver.php

Line Number: 188

Backtrace:

A PHP Error was encountered

Severity: Warning

Message: filesize(): stat failed for /var/lib/php/sessions/ci_session1675012f121658f4c6d656e73dd67d2a71df3e14

Filename: drivers/Session_files_driver.php

Line Number: 192

Backtrace: