Sim Posted December 21, 2020 Posted December 21, 2020 TPL form data public $crimeForm = ' <form method="post" action="?page=admin&module=crimes&action={editType}&id={id}"><div class="row"> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Crime Name</label> <input type="text" class="form-control" name="name" value="{name}"> </div> </div> <div class="form-group"> <label class="pull-left">Crime Locations: </label> <select class="form-control" name="locations[]" id="locations[]" size="10" multiple="multiple"> <option value="0">All</option> {#each loc} <option value="{id}" {selected}>{name}</option> {/each} </select> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Message for successful crime</label> <input type="text" class="form-control" name="success" value="{success}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Message for failed crime</label> <input type="text" class="form-control" name="fail" value="{fail}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Chance crime is committed against another player. (ex: 50, would be %50 of time.)</label> <input type="number" class="form-control" name="playerPerc" value="{playerPerc}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Message sent to victim (ex: [convict] just mugged one of your family members for $[cash] or [bullets])</label> <input type="text" class="form-control" name="victimMsg" value="{victimMsg}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Message displayed to person committing crime against player. (Ex: You just mugged [victim]s family member for $[cash] or [bullets])</label> <input type="text" class="form-control" name="convictMsg" value="{convictMsg}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Chance Of Item?</label> <input type="number" class="form-control" name="itemChance" value="{itemChance}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Chance Item is Taken From Player?</label> <input type="number" class="form-control" name="itemPlayerChance" value="{itemPlayerChance}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Reward Random Item From Item Group?(ex: add item group # like blackmarket)</label> <input type="number" class="form-control" name="itemType" value="{itemType}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Reward Item?</label> <select class="form-control" name="itemID"> <option value="0">None</option> {#each items} <option value="{itemID}" {itemPicked}>{itemName}</option> {/each} </select> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Required equipped Item type?(ex: 1 is weapon, 2 is armor, ).</label> <input type="number" class="form-control" name="reqItemType" value="{reqItemType}"> </div> </div> <div class="col-md-3"> <div class="form-check"> <label class="form-check-label">Loose Item If Fail?</label> <input type="checkbox" class="form-check-input" name="itemLoose" value="y"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Min. money for successful crime</label> <input type="number" class="form-control" name="money" value="{money}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Max. monney for successful crime</label> <input type="number" class="form-control" name="maxMoney" value="{maxMoney}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Min. bullets for successful crime</label> <input type="number" class="form-control" name="bullets" value="{bullets}"> </div> </div> <div class="col-md-3"> <div class="form-group"> <label class="pull-left">Max. bullets for successful crime</label> <input type="number" class="form-control" name="maxBullets" value="{maxBullets}"> </div> </div> </div> <div class="row"> <div class="col-md-4"> <div class="form-group"> <label class="pull-left">Cooldown (Seconds)</label> <input type="number" class="form-control" name="cooldown" value="{cooldown}"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="pull-left">EXP Gained</label> <input type="number" class="form-control" name="exp" value="{exp}"> </div> </div> <div class="col-md-4"> <div class="form-group"> <label class="pull-left">Min user level to comit this crime</label> <input type="number" class="form-control" name="level" value="{level}"> </div> </div> </div> <div class="text-right"> <button class="btn btn-default" name="submit" type="submit" value="1">Save</button> </div> </form> '; } PHP insert code $insert = $this->db->prepare(" INSERT INTO crimes ( C_name, C_location, C_success, C_fail, C_convictMsg, C_victimMsg, C_cooldown, C_money, C_maxMoney, C_level, C_bullets, C_maxBullets, C_exp, C_playerPerc, C_itemType, C_itemID, C_itemChance, C_itemPlayerChance, C_itemLoose, C_reqItemType ) VALUES ( :name, :locIDs, :success, :fail, :convictMsg, :victimMsg, :cooldown, :money, :maxMoney, :level, :bullets, :maxBullets, :exp, :playerPerc :itemType, :itemID, :itemChance, :itemPlayerChance, :itemLoose, :reqItemType ); "); var_dump($this->methodData); if(empty ($this->methodData->itemLoose)){ $itemLoose = 'y'; } else { $itemLoose = 'n'; } if(empty ($this->methodData->reqItemType)){ $reqItemType = 'y'; } else { $reqItemType = 'n'; } $locIDs = ":-1:"; if(!empty($this->methodData->locations)){ //if item types selected greater then 0 if(count($this->methodData->locations) > 0){ //cycle threw item types selected foreach($this->methodData->locations as $loc) { //if type not "None" if($loc != 0) { $locIDs .= $loc . ":"; } } } } $insert->bindParam(":name", $this->methodData->name); $insert->bindParam(":locIDs", $locIDs); $insert->bindParam(":cooldown", $this->methodData->cooldown); $insert->bindParam(":money", $this->methodData->money); $insert->bindParam(":maxMoney", $this->methodData->maxMoney); $insert->bindParam(":level", $this->methodData->level); $insert->bindParam(":bullets", $this->methodData->bullets); $insert->bindParam(":maxBullets", $this->methodData->maxBullets); $insert->bindParam(":exp", $this->methodData->exp); $insert->bindParam(":success", $this->methodData->success); $insert->bindParam(":fail", $this->methodData->fail); $insert->bindParam(":convictMsg", $this->methodData->convictMsg); $insert->bindParam(":victimMsg", $this->methodData->victimMsg); $insert->bindParam(":playerPerc", $this->methodData->playerPerc); $insert->bindParam(":itemChance", $this->methodData->itemChance); $insert->bindParam(":itemPlayerChance", $this->methodData->itemPlayerChance); $insert->bindParam(":itemType", $this->methodData->itemType); $insert->bindParam(":itemID", $this->methodData->itemID); $insert->bindParam(":itemLoose", $itemLoose); $insert->bindParam(":reqItemType", $reqItemType); $insert->execute(); DATA & error screenshot I found it. Behind PlayerPerc like last time. @Magictallguy 🙂 Quote
Magictallguy Posted December 21, 2020 Posted December 21, 2020 I strongly recommend a method known as Rubber Duck Debugging. The concept may sound daft, but I know it works for some. Grab a rubber duck, put it on your desk, talk it through your code next time you're debugging 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.