Error while delete event

QuestionsError while delete event
Anand Tj asked 8 months 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 8 months 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
PHP Grid Framework
 
Anand Tj answered 8 months ago

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

Abu Ghufran Staff answered 8 months 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
PHP Grid Framework
 
Your Answer

16 + 12 =

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 / 5. Vote count:

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

Let us improve this post!