sarfraznawaz2005 / VisualQuery

MySQL Database Browser with ability to create visual queries for non-technical people or clients.
40 stars 22 forks source link

'Error: SQLSTATE[HY000]: General error' when execute an update custom query #2

Open gpstiip88 opened 9 years ago

gpstiip88 commented 9 years ago

When I try to execute a custom query with an update command, I receive a general error: Error: SQLSTATE[HY000]: General error

With some research on Google, I discovered that the command 'fetchAll()' cannot be call after an update command, so I've changed the line 235 on file app/controllers/table.php

From $data = $stmt->fetchAll(PDO::FETCH_ASSOC); to if( preg_match('/^select/i', $query) )$data = $stmt->fetchAll(PDO::FETCH_ASSOC);

and in this way everything works, but without visual results.

I wish that this can be usefull for someone.

sarfraznawaz2005 commented 9 years ago

Thanks for finding and figuring it out, I am so busy that I couldn't even look. Thanks

Regards, Sarfraz http://sarfraznawaz.wordpress.com

On Wed, Aug 5, 2015 at 12:54 PM, gpstiip88 notifications@github.com wrote:

When I try to execute a custom query with an update command, I receive a general error: Error: SQLSTATE[HY000]: General error

With some research on Google, I discovered that the command 'fetchAll()' cannot be call after an update command, so I've changed the line 235 on file app/controllers/table.php

From $data = $stmt->fetchAll(PDO::FETCH_ASSOC); to if( preg_match('/^select/i', $query) )$data = $stmt->fetchAll(PDO::FETCH_ASSOC);

and in this way everything works, but without visual results.

I wish that this can be usefull for someone.

— Reply to this email directly or view it on GitHub https://github.com/sarfraznawaz2005/VisualQuery/issues/2.