title: Check mysql table if record already exists
body: <p>I'm using the following to insert company data into a mysql table. Is is possible to check if the company is already in the database first before it tries to enter it in again? The php variable <code>$company</code> is what I want to check against.</p>
  
  <pre><code>   &lt;?php
      require("database.php");
      // Opens a connection to a MySQL server
      $con = mysql_connect("localhost", $username, $password);
  
      if (!$con)
        {
        die('Could not connect: ' . mysql_error());
        }
  
      mysql_select_db("medicom_wp", $con);
  
      $pages = get_posts(array(
          'orderby' =&gt; 'title', 
          'post_type' =&gt; 'members',
          'numberposts' =&gt; 300,
          'post_status' =&gt; 'any'  
          ));
          foreach($pages as $post) {
          setup_postdata($post);
  
          $company = get_field('company_name');
          $address = get_field('address');
          $city = get_field('city');
          $post_code = get_field('post_code');
  
          mysql_query("INSERT INTO markers (`name`, `address`, `lat`, `lng`, `type`) VALUES ('".$company."', '".$address.", ".$city.", ".$post_code."', '0.0', '0.0', '')");
          }
          wp_reset_query();
  
      mysql_close($con);
      ?&gt;
  </code></pre>