4 Replies Latest reply on Jul 26, 2010 12:56 AM by djh88ukwb

    AMFPHP Update script, works just need to expand

    djh88ukwb Level 1

      Hello All.

       

      I have the following AMFPHP function,

       

      function insertVideo($ID,$Video)
      {
      $mysql = mysql_connect($this->db_host, $this->db_user, $this->db_pwd);
      mysql_select_db( $this->db_name);
      $sql = "UPDATE usernames SET video1 = '$Video' WHERE ref ='$ID'";
      $Result = mysql_query( $sql);
      return $Result;
      }

       

      It works fine, taking the vales form flex and inserting them into the database.

       

      However i need to expand on it slightly.

       

      My database has a couple of fields named

           - video1

           - video2

           - video3

       

      At the moment my function just inserts the values into "Video1".

       

      But what i want it to do is to loop thru a function, and check if video1 has data in it, if it does, check video2, and if this field has no data, paste the data here, if it does have data, check field video3, if this dosent have data then paste the value here, if it does have data, simply dont save it anywhere.

       

      Can anyone help me with this ?

       

      Basically i dont want the script to overwrite an old value, instead move to the next field.

       

      If you dont understand i can try to explain further.