Web Analytics Made Easy -
StatCounter Help Fetching stuff from Mysql properly - CodingForum


No announcement yet.

Help Fetching stuff from Mysql properly

  • Filter
  • Time
  • Show
Clear All
new posts

  • Help Fetching stuff from Mysql properly

    Hi there..

    Ive got this game running and im adding some stuff to a already made script..
    Im trying to add some missions to the game.
    In the Db (MySql) ive added 3 fields to the Userrow (mission1, kills, missionmonster)
    Once the mission starts the mission1 value is set to "Started" (The value "half done" is then added once they kill all the ones they need (wich is 5)
    Here is when it gets a bit to tricky for me..

    Before the following PHP Code there is a fight script wich is not really relevant for the following code as its called if the player WINS the battle.

    The value missionmonster is having the value set to the name of the monster they need to kill, when they accept the mission.

    PHP Code:
    function victory() {


     if (
    $userrow["mission1"] == "Started") {
          if (
    $monsterrow["name"] == $userrow["missionmonster"]) {
    $updatequery doquery("UPDATE {{table}} SET kills=kills+1 WHERE id='".$userrow["id"]."' LIMIT 1""users");
             if (
    $userrow["kills"] == 5) {
    $updatequery doquery("UPDATE {{table}} SET mission1=Half Complete WHERE id='".$userrow["id"]."' LIMIT 1""users");
    Im not sure why, but the code does not register if the current monster is THE monster needed for the mission and thus does not update the kill value.

    I hope im making a bit sense..

    All im asking is a little push in the right direction on how i get code to register that you actually killed the monster you needed and then update the DB with the value.

  • #2
    PHP Code:
    $updatequery doquery("UPDATE {{table}} SET mission1='Half Complete' WHERE id='".$userrow["id"]."' LIMIT 1""users"); 
    i think some quotes may help
    Free php image upload script
    Personal web developing blog


    • #3
      lmao ohh man why didnt i spot that one

      I will try that right away.


      • #4
        It still does not update the Kills field in the Database with one extra kill

        I will post the entire code i have for that part in a few minuts.. maybe it will be more clear what im doing wrong ????


        • #5
          nevermind i got it working