title: update mysql and add value to existing value
body: <p>I am trying to edit this code so that instead of just inserting the info - it checks to see if the file already exists in the database, if it does it inserts as it does now.  If it does exist... it should just update the info, adding the "value" amount to the value amount already in there instead of replacing it.  But this is very new to me and I am lost so any help with really be appreciated!</p>
  
  <pre><code>&lt;?php
   define('JPATH_BASE',$_SERVER['DOCUMENT_ROOT']);
   require_once($_SERVER['DOCUMENT_ROOT']."/b2/configuration.php");
  
   require_once($_SERVER['DOCUMENT_ROOT']."/b2/libraries/joomla/factory.php");
   require_once($_SERVER['DOCUMENT_ROOT']."/b2/libraries/joomla/base/object.php");
   require_once($_SERVER['DOCUMENT_ROOT']."/b2/libraries/joomla/database/database.php");
   require_once($_SERVER['DOCUMENT_ROOT']."/b2/libraries/joomla/database/database/mysql.php");
  
   $config = new JConfig;
   $options = array();
   $options['host'] = $config-&gt;host;
   $options['user'] = $config-&gt;user;
   $options['password'] = $config-&gt;password;
   $options['database'] = $config-&gt;db;
   $options['prefix'] = $config-&gt;dbprefix;
   $options['select'] = true;
  
  
   $db = new JDatabaseMySQL($options);
  
   //$user = JFactory::getUser();
   $userId = 0;
   //($user-&gt;id &gt; 0) ? $user-&gt;id : 0;
   $numbervote = $_REQUEST['w'];
   $folder = $_REQUEST['w2'];
   $name = $_REQUEST['w1'];
    $date = date('Y-m-d H-i-s');
    $sql = "INSERT INTO jos_image_ratetting (id,userid,datecreated,value,filename,folder,md5name) VALUES(NULL,'".$userId."','".$date."','".$numbervote."','".$name."','".$folder."',MD5('".$name."'))";
    $db-&gt;setQuery($sql);
    if($db-&gt;query()){
     $msg = "Thanks for rate!";
    }else{
     $msg = mysql_error();
    }
    echo $msg;
   //echo 'Hello';
  
  ?&gt;
  </code></pre>