title: Script to update mysql not working
body: <p>Okay so I have a PHP script that makes a user an artist if vote is high enough. The first part of the script works (the part that does the voting). However, the second part of the script that makes a user an artist does not. It worked before on localhost but is not working on live server for some reason. Either the script has changed and I didn't notice it or there's something wrong with my server config. </p>
  
  <p>I know I should be using mysqli but please don't mention that I am working on it.</p>
  
  <p>To explain how the system works, a form on the voting page is posted to this script and it all runs from there.</p>
  
  <p>There is no error in the error log. Updating the table for //make an artist if vote high enough just doesn't work.</p>
  
  <p>Here's the script:</p>
  
  <pre><code>&lt;?php
  session_start();
  include("../database.php");
   $username = $_SESSION["username"];
  $artistname = htmlspecialchars(mysql_real_escape_string($_POST['artistname']));
  $trackname = htmlspecialchars(mysql_real_escape_string($_POST['trackname']));
  $trackurl = htmlspecialchars(mysql_real_escape_string($_POST['trackurl']));
  
  $flag = 0; // Safety net, if this gets to 1 at any point in the process, we don't upload.
  if(isset($_POST['yes'])){
  
  //code runs if vote is yes
  
  
  //check if user hasnt already voted on track
  
   $result = mysql_query("SELECT username FROM voted WHERE voted='$artistname' AND trackname='$trackname' AND username='$username'")or die(mysql_error());
   $check2 = mysql_num_rows($result);
  
   if ($check2 != 0) {
  
      echo('&lt;t1&gt;Sorry, you have already voted on this track. &lt;b&gt;Click next track.&lt;/b&gt;     &lt;/t1&gt;');
     $flag = $flag + 1;
  }
  
  //code runs if everything is okay  
  if($flag == 0){
  mysql_query("UPDATE members SET vote = vote+1 WHERE artistname='$artistname'
  ");
  
  
  echo '&lt;t1&gt;&lt;b&gt;You liked the track "'.$trackname.'" by "'.$artistname.'"&lt;/t1&gt;&lt;/b&gt;';
  
  
  
   mysql_query("INSERT INTO voted  (username, voted,trackname, yesno)
  
          VALUES ('".$username."','".$artistname."','".$trackname."', 'yes')")
  
  or die(mysql_error()); 
  
  //make an artist if vote high enough
  $vote = mysql_query("SELECT vote FROM members WHERE artistname='$artistname'")or die(mysql_error());
  
  
   if ($vote &gt; 50) {
   $artisturl = htmlspecialchars(mysql_real_escape_string(str_replace(' ', '',$_POST['artistname'])));
  
  mysql_query("UPDATE members SET artist='Y', image1='../files/noprofile.jpg', artisturl='$artisturl' WHERE artistname='$artistname'
   ")or die(mysql_error());
  
   mysql_query("UPDATE tracks SET artist='Y', artisturl='$artisturl' WHERE artistname='$artistname'
  ")or die(mysql_error());
  
  //email user that has just been made artist
  $result = mysql_query("SELECT * FROM members WHERE artistname= '$artistname'");
  while($row = mysql_fetch_array($result)){
  function spamcheck($field)
  {
  //filter_var() sanitizes the e-mail
  //address using FILTER_SANITIZE_EMAIL
   $field=filter_var($row['email'], FILTER_SANITIZE_EMAIL);
  
   //filter_var() validates the e-mail
   //address using FILTER_VALIDATE_EMAIL
    if(filter_var($row['email'], FILTER_VALIDATE_EMAIL))
     {
    return TRUE;
    }
    else
   {
    return FALSE;
   }
   }
   {//send email
   $to = $row['email'];
   $subject = "Congratulations! You're now an NBS artist";
   $message = "Hi ".$row['artistname'].",
   //message removed for condensed code
   $from = "";
   $headers = 'From:' . "\r\n" .
  'Reply-To: ' . "\r\n";
  mail($to,$subject,$message,$headers);   
   }
   }
   echo '&lt;br&gt;&lt;t1&gt;You just made "'.$artistname.'" an artist! &lt;a href="'.$artisturl.'"&gt;&lt;b&gt;Click here&lt;/b&gt;&lt;/a&gt; to see their profile.&lt;/t1&gt;';
   }
   }
   } 
  </code></pre>