MySQL query executes outside of PHP, but not in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am running: PHP 5.2.8, Apache 2.2.11, MySQL 5.1.30 on Win32/XP.

I have a number of queries on my page which are very similar in
structure, and they all work except for the following one. 

$mysql['process'] = $client2->real_escape_string($clean['process']);

$sql = "SELECT f.name, f.description
        FROM files f, file_mapping m, processes p
        WHERE m.file_id = f.id
        AND p.name = '{$mysql['process']}'
        AND m.process_id = p.id
        AND m.io_flag = 'I'";

if ($client2->multi_query($sql)) {
  echo '<h3 class="H3-OTMS">Main Input Files</h3>';
  do {
    if ($result = $client2->use_result()) {
         while ($input = $result->fetch_row()) {
               $filename = $input[0];
               $descr = $input[1];
               echo '<p><span class=FileName>'.$filename.'</span>'.'
'.$descr.'</p>';
             }
            $result->close();
            }
    } while ($client2->next_result());
    }


If I echo the $sql, and then run it in MySQL directly, it works fine.  I
have tried replacing the variable in the WHERE clause with a hardcoded
value and and have tried replacing this query with a very basic query
with no variable, but nothing has worked. No error message is returned.

Any suggestions as to what I might check?  Here's an example of an echo
of the following $sql that runs OK in MySQL Query Browser:
SELECT f.name, f.description FROM files f, file_mapping m, processes p
WHERE m.file_id = f.id AND p.name = 'BCOM1AC' AND m.process_id = p.id
AND m.io_flag = 'I'

Thanks,
Dave


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux