title: php pdo query fails to return result despite prepared statement being correct
body: <p>I have the following php/pdo which calls a a mysql procedure which returns a filename however despite the prepared statement being correct and returning the following from a cut and pasted db query:</p>
  
  <p><strong>db query/result</strong></p>
  
  <pre><code>&gt;     call sp_CDRbyCustomer('Wind', 'R2X', DATE(DATE_SUB(NOW(), INTERVAL 10 WEEK)), DATE(NOW()));
  &gt;     +------------------------------------------------------+
  &gt;     | Exported filename                                    |
  &gt;     +------------------------------------------------------+
  &gt;     | '/tmp/CDR_for_Wind_20140704-20140912_1410516460.csv' |
  &gt;     +------------------------------------------------------+
  &gt;     1 row in set (0.02 sec)
  </code></pre>
  
  <p><strong>the php/pdo</strong> </p>
  
  <p>which should return our filename is:</p>
  
  <pre><code>include('db.ini');
  
  define('DEBUG', true);
  if (DEBUG ) {
          openlog("$iam", LOG_PID | LOG_ODELAY,LOG_LOCAL4);
          syslog(LOG_INFO, "START OF DEBUG LOG.");
  }
  
  /***** connect to database using db.ini for credentials *****/
  try {
  $dbConn =  new PDO('mysql:host='.$host.';dbname='.$db, $dbUser, $dbPass, array (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION));
  
  } catch (PDOException $e) {
      print "Error!: " . $e-&gt;getMessage() . "&lt;br/&gt;";
      die();
  }
  
  $structure_name = "'Wind'";
  $cug_uid = "'R2X'";
  $num_weeks = 10;
  
  /**** Query - export file name ****/
  $sqlQuery4filename = ("
  call sp_CDRbyCustomer($structure_name, $cug_uid, DATE(DATE_SUB(NOW(), INTERVAL $num_weeks WEEK)), DATE(NOW()))
  ");
  $sqlQuery4filename = preg_replace( "/\r|\n/", "", $sqlQuery4filename );
  
      debug("01: sqlQueryfile string is '" . $sqlQuery4filename . "'");
      $stmnt = $dbConn-&gt;prepare($sqlQuery4filename);
      debug($stmnt);
      $stmnt-&gt;execute();
      $stmnt-&gt;closeCursor();
      $filename = $stmnt-&gt;fetch(PDO::FETCH_ASSOC);
      $filename = $filename['Exported filename'];
      debug("01: filename string is '" . $filename . "'");
  
  function debug($debug) {
  if(!DEBUG) return;
  
  print '
  &lt;div class="debug"&gt;
  ';
  print_r($debug);
  print '
  &lt;/div&gt;&lt;!-- end of debug --&gt;
  ';
  }
  </code></pre>
  
  <p>However I only ever get an empty string returned.</p>
  
  <p>I have had this working, but after subversioning it I ended up with the wrong version and can no longer get it to work, anybody give me any clues to what I'm doing wrong.</p>