Jump to content
MakeWebGames

Need extra set of eyes plz [column count dont match


Recommended Posts

Posted
           $update = $this->db->prepare("
              UPDATE
                crimes 
              SET
                C_name=:name,
                C_chance:chance,
                C_success=:success,
                C_fail=:fail,
                C_convictMsg=:convictMsg,
                C_victimMsg=:victimMsg,
                C_cooldown=:cooldown,
                C_money=:money,
                C_maxMoney=:maxMoney,
                C_level=:level,
                C_bullets=:bullets,
                C_maxBullets=:maxBullets,
                C_exp=:exp,
                C_playerPerc=:playerPerc
              WHERE 
                C_id=:id
                ");
  $update->bindParam(":name", $this->methodData->name);
  $update->bindParam(":chance", $this->methodData->chance);
  $update->bindParam(":success", $this->methodData->success);
  $update->bindParam(":fail", $this->methodData->fail);
  $update->bindParam(":convictMsg", $this->methodData->convictMsg);
  $update->bindParam(":victimMsg", $this->methodData->victimMsg); 
  $update->bindParam(":cooldown", $this->methodData->cooldown);
  $update->bindParam(":money", $this->methodData->money);
  $update->bindParam(":maxMoney", $this->methodData->maxMoney);
  $update->bindParam(":level", $this->methodData->level);
  $update->bindParam(":bullets", $this->methodData->bullets);
 $update->bindParam(":maxBullets", $this->methodData->maxBullets);
  $update->bindParam(":exp", $this->methodData->exp);
  $update->bindParam(":playerPerc", $this->methodData->playerPerc);
  $update->bindParam(":id", $this->methodData->id);
    
 $update->execute();

Line: 227
Error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in

from what i can count. Both have 15 bound variables?

 

Posted
20 minutes ago, Curt said:

is it this ?

 


C_chance:chance,

maybe it should be

 


C_chance=:chance,

SMH, stating at that for 2-3hrs straight. Its always the smallest things like that that gets men stumped. Thanks @Curt

  $update = $this->db->prepare("
UPDATE
  crimes
SET
 C_name=:name,
 C_chance=:chance,
 C_success=:success,
 C_fail=:fail,
 C_convictMsg=:convictMsg,
 C_victimMsg=:victimMsg,
 C_cooldown=:cooldown,
 C_money=:money,
 C_maxMoney=:maxMoney,
 C_level=:level,
 C_bullets=:bullets,
 C_maxBullets=:maxBullets,
 C_exp=:exp,
 C_playerPerc=:playerPerc
WHERE 
 C_id=:id
 ");

Now i an getting thia dang error. Everything looks get to me. I'm going to sleep. I keep dropping my phone and when it hits the floor is when i wake back up

 

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE  C_id='2'' at line 18 in

Posted
17 hours ago, Sim said:

[...]

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE  C_id='2'' at line 18 in

Got a bind value for :playerPerc?

Posted
Quote
Quote


object(stdClass)#116 (19) { ["page"]=> string(5) "admin" ["module"]=> string(6) "crimes" ["action"]=> string(4) "edit" ["id"]=> string(1) "2" ["name"]=> string(16) "Rob a cab driver" ["success"]=> string(16) "successful crime" ["fail"]=> string(12) "failed ceime" ["playerPerc"]=> string(2) "50" ["victimMsg"]=> string(35) "[convict] crimed against you [cash]" ["convictMsg"]=> string(44) "success crime against player [victim] [cash]" ["money"]=> string(2) "10" ["maxMoney"]=> string(2) "18" ["bullets"]=> string(1) "0" ["maxBullets"]=> string(1) "0" ["chance"]=> string(2) "50" ["cooldown"]=> string(2) "45" ["exp"]=> string(1) "2" ["level"]=> string(1) "2" ["submit"]=> string(1) "1" }

 

 

All binds have values. This has me a bit confused

object(stdClass)#116 (19) { ["page"]=> string(5) "admin" ["module"]=> string(6) "crimes" ["action"]=> string(4) "edit" ["id"]=> string(1) "2" ["name"]=> string(16) "Rob a cab driver" ["success"]=> string(16) "successful crime" ["fail"]=> string(12) "failed ceime" ["playerPerc"]=> string(2) "50" ["victimMsg"]=> string(35) "[convict] crimed against you [cash]" ["convictMsg"]=> string(44) "success crime against player [victim] [cash]" ["money"]=> string(2) "10" ["maxMoney"]=> string(2) "18" ["bullets"]=> string(1) "0" ["maxBullets"]=> string(1) "0" ["chance"]=> string(2) "50" ["cooldown"]=> string(2) "45" ["exp"]=> string(1) "2" ["level"]=> string(1) "2" ["submit"]=> string(1) "1" }

Posted
10 hours ago, Magictallguy said:

Got a weird character for your newline?
 

C_playerPerc=:playerPerc -- here WHERE


C_playerPerc=:playerPerc
-- here
WHERE 

 

I dont know, i just deleted lines from C_playerPerc to C_id=

Then retyped them, same error.

Why i am stumped

Edit: i didn't upload the file after i deleted lines before checking. Note that i uploaded the file, it seems like there was an weird invisible line break character there. Works like charm. Thanks

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...