php - Syntax error or access violation using PDO -


I am transferring my local files online and facing PHP problems with my DB script. Works locally well (running PHP 5.3.8) but I found the following errors on my server (PHP 5.3.10)

Without $ DBH-> Set Attribution (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION);

Fatal Error: On a non-object, call 108 /

on a member function setFetchMode () on the /.../...php> $ DBH- & gt; Set Attribute (PDO :: ATTRRAMOD, PDO :: ERRMDDEXPTN); SQLSTATE [42000]: Syntax error or access violation: 1142 SELECT command denied user. '' 'Invited' for '205.186.180.26' table '

/ Blockquote>

Here's my code:

  class guest {public $ id; Public $ guest_name; Public $ url_phrase; } $ Guest = new guest; If (isset ($ _GET ['p'])) {$ url_phrase = urldecode ($ _ GET ['p']); } And if (isset ($ _ POST ['p'])) {$ url_phrase = urldecode ($ _ POST ['p']); } If (isset ($ url_phrase)) {{$ DBH = new PDF ("mysql: host = myhost.com; dbname = mydbname", "myusername", "mypassword"); $ DBH- & gt; Set Attribute (PDO :: ATTRRAMOD, PDO :: ERMMDMEXEPEPS); $ Url_phrase = $ DBH- & gt; Bid ($ url_phrase); $ Sql ​​= "SELECT id, guest_name, url_phrase from mydbname.invited WHERE url_phrase = $ url_phrase"; $ Stmt = $ DBH- & gt; Query ($ sql); $ Stmt- & gt; SetFetchMode (PDO :: FETCH_INTO, new guest); $ GuestNumber = $ stmt- & gt; Punctiquity (); If ($ guestNumber & gt; 0) {etc ...} if ($ guestType == "single") {foreach ($ guest $ as stmt) $ $ {$ name = $ guest- & gt; Guest_name; Etc ...}}} and {other stuff .. etc .. $ dbh = empty; } Hold (PDOException $ e) {echo $ e-> GetMessage (); }}   

I have received simple selection statements to work fine as this user (I do not think its related to this permission), my problem is with my implementation of PDO. How can I get rid of this error? Am I preparing / executing a strange statement which is messing up? Thanks for any help

I had the same problem uploading my code from local to production server After, and the user had all the privileges The problem was the name of the database - in my local environment it was like Dartbaz 1 and the name of the output was different ... prefix_ddatabas1 I changed the database name correctly and everything was fine.

Comments