Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Suppress SQLSTATE[HY000]: General error

I have a Raw SQL query I'm executing:

$winner = "55ee5c4e302cd";
$sql   = "UPDATE users,
          (SELECT * FROM
           phistbumps
           WHERE contest=$contestId AND image='$winner') winners
          SET users.levelProgress = users.levelProgress+20
          WHERE users.id=winners.user";
$notifications = new Notifications();
$notifications = new Resultset(null, $notifications, $notifications->getReadConnection()->query($sql));

The query works just fine, the values I want incremented in the DB are incremented, but it's echoing the SQLSTATE error, even when I don't specify for any output. Is there any way to suppress this error message?

I get no errors when I run this query through phpMyAdmin, so I believe the query is fine. I believe the issue is that no resulset is returned, what syntax will allow me to execute the query without expecting a return?



2.6k
Accepted
answer

Nevermind, just figured it out myself:

    $progress = new Users();
    $progress->getReadConnection()->query($sql);

Not sure which change fixed it, I first removed the unnecessary Resultset function, and I also made the model being used match the table that the query was being executed on.