title: My column is not blank but i'm getting this error: Unknown column '' in 'where clause'
body: <p>I know the column npi exists so I'm not sure why i'm getting this error; I've read a few other threads on here but nothing is working for me. In my where clause, i've tried backticks and single quotes but no avail. Any help would be greatly appreciated. Thank you.   </p>
  
  <pre><code> &lt;?php
      include('config.php');
      if (isset($_GET['insurance_id']) ) {
      $insurance_id = (string) $_GET['insurance_id'];
      if (isset($_POST['submitted'])) {
      foreach($_POST AS $key =&gt; $value) { $_POST[$key] = mysql_real_escape_string($value); }
      $sql = ("UPDATE `doctor_data` SET `dr_first_name` = '{$_POST['dr_first_name']}', `dr_last_name` = '{$_POST['dr_last_name']}' where npi='$npi'");
  
      mysql_query($sql) or die(mysql_error());
      echo (mysql_affected_rows()) ? "Edited Record.&lt;br /&gt;" : "Nothing changed. &lt;br /&gt;";
      echo "&lt;a href='index.php?id=28&amp;insurance_id=($REQUEST:insurance_id)'&gt;Back To List&lt;/a&gt;";
      }
      $row = mysql_fetch_array ( mysql_query("SELECT * from `doctor_data`"));
      ?&gt;
  
      &lt;form action='' method='POST'&gt;
      &lt;p&gt;&lt;b&gt;Doctor:&lt;/b&gt;&lt;br /&gt;&lt;input type='text' name='dr_first_name' value='&lt;?= stripslashes($row['dr_first_name']) ?&gt;' /&gt; &lt;input type='text' name='dr_last_name' value='&lt;?= stripslashes($row['dr_last_name']) ?&gt;' /&gt;
      &lt;p&gt;&lt;input class="btn btn-success" type='submit' value='Update Record' /&gt;&lt;input type='hidden' value='1' name='submitted' /&gt;
      &lt;/form&gt;
      &lt;? } ?&gt;
  </code></pre>
  
  <p>Additionally, the data is being saved on the form after it's being posted but not into the database and upon pushing the post button I receive the error message posted in the title. </p>
  
  <pre><code>-- phpMyAdmin SQL Dump
  -- version 3.4.11.1
  -- http://www.phpmyadmin.net
  --
  -- Host: localhost
  -- Generation Time: Feb 15, 2013 at 05:50 PM
  -- Server version: 5.5.23
  -- PHP Version: 5.2.17
  
  SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  SET time_zone = "+00:00";
  
  
  /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  /*!40101 SET NAMES utf8 */;
  
  --
  -- Database: `anag_demo`
  --
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `doctor_data`
  --
  
  CREATE TABLE `doctor_data` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `npi` int(11) DEFAULT NULL,
    `dr_first_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
    `dr_last_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
    PRIMARY KEY (`id`),
    KEY `npi` (`npi`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=17 ;
  
  /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  </code></pre>