Error while delete event

QuestionsError while delete event
Anand Tj asked 6 years ago

I am using the file upload demo code on my server and all works great except the delete operation. I get below error while trying to delete a record that is already added to the grid(with image).

View post on imgur.com

code used is https://gist.github.com/anandatheerthan/446e9e59adf8738ea4ec22877dc99f71

3 Answers
Abu Ghufran Staff answered 6 years ago

The code seems fine and error shows you are using it inside laravel.

In any case, you can create new object inside function and use it to call get_one() function.

function delete_upload($data)
{

$db_conf = array(
“type” => PHPGRID_DBTYPE,
“server” => PHPGRID_DBHOST,
“user” => PHPGRID_DBUSER,
“password” => PHPGRID_DBPASS,
“database” => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);

//phpgrid_error($data[id]);
$rs = $g->get_one(“SELECT image_path FROM mugshots_images WHERE id = {$data[id]}”);
unlink(realpath($rs[“image_path”]));
}

 

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Anand Tj answered 6 years ago

Thanks, thats exactly what I did. Any idea why $g global doesnt work.

Abu Ghufran Staff answered 6 years ago

I don’t know exactly. May be it’s due to namespaces used in laravel and limiting scope of $g.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

18 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?