Problem with code between 2 diffrent sites with mysql fetch

I have 2 sites. One for production and one for test.   The production site is a VPS (may or not mean anything).  I have an inclusion, all of a sudden the production site returns an error!

This is the error and the screen from production:

SurveySeq = NY10460%
String2 = SELECT * FROM mapfile WHERE SEQ LIKE 'NY10460%' AND BNMB >= 400 - 10 AND BNMB <= 400 + 10 ORDER BY ABS(400 - BNMB) ASC LIMIT 1


Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/langsyst/public_html/lansco/BuildingChk.php on line 167 String2 = SELECT * FROM mapfile WHERE SEQ LIKE 'NY10460%' AND BNMB >= 400 - 10 AND BNMB <= 400 + 10 ORDER BY ABS(400 - BNMB) ASC LIMIT 1 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/langsyst/public_html/lansco/BuildingChk.php on line 174 count (194) = count =
menu = 5

This is the code from production:
if ($_SESSION['Menu_No'] == 3)
      {
            $SqlString2 = "SELECT * FROM survey_data WHERE
                              SEQ LIKE '$SurveySeq'
                              AND
                              ADDRESS like '$SurveyAddress'";
      }
else
      {
            $SqlString2 = "SELECT * FROM mapfile
                                    WHERE
                                          SEQ LIKE '$SurveySeq'
                                    AND
                                          BNMB >= $work - 10
                                    AND
                                          BNMB <= $work + 10
                                    ORDER BY
                                          ABS($work - BNMB)
                                          ASC
                                          LIMIT 1";
echo "SurveySeq = ".$SurveySeq."<br>";
echo "String2 = ".$SqlString2."<br><br><br>";
      }
$Survey_File = mysql_query($SqlString2);
$ROW2=mysql_fetch_array($Survey_File, MYSQL_BOTH);
---------------------------------------------------------------------------------------
The test site has the following code:
if ($_SESSION['Menu_No'] == 3)
      {
            $SqlString2 = "SELECT * FROM survey_data WHERE
                              SEQ LIKE '$SurveySeq'
                              AND
                              ADDRESS like '$SurveyAddress'";
      }
else
      {
            $SqlString2 = "SELECT * FROM mapfile
                                    WHERE
                                          SEQ LIKE '$SurveySeq'
                                    AND
                                          BNMB >= $work - 10
                                    AND
                                          BNMB <= $work + 10
                                    ORDER BY
                                          ABS($work - BNMB)
                                          ASC
                                          LIMIT 1";
      }
$Survey_File = mysql_query($SqlString2);
$ROW2=mysql_fetch_array($Survey_File, MYSQL_BOTH);
--------------------------------------------------------------------------------
If you take out the "echo" in the production they are both the same.
WTF!!!
breeze351Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Let's start with this: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given

That usually means that the query failed, perhaps because of a syntax error or failure of the server.  This article can show you how to test the query results and determine if the query succeeded or failed.  If it failed you can use the examples here to print out the error messages.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html

You might also want to add error_reporting(E_ALL) to the script.  PHP may have some things to tell you, but you won't see these things unless you raise the error report yourself.

As you will also see in that article, PHP is doing away with MySQL support, so you will need to move to one of the supported extensions.  If you choose object-oriented MySQLi the conversion is fairly easy.
0
Ray PaseurCommented:
For a quick-and-dirty check on the MySQL failure, put these two instructions after the call to MySQL_Query() and show us the output, please.

var_dump($Survey_File);
var_dump( mysql_error() );
0
Dave BaldwinFixer of ProblemsCommented:
I agree with Ray, that error message normally means the query failed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

breeze351Author Commented:
Ok, the query failed.  Why does the code work on one site but not the other?  Also if you read the original post, the only difference is that the site with the error is running VPS.  And I said before,  I haven't touched this code since 04/17/2015.
0
breeze351Author Commented:
I got it.  Dumb partner renamed "mapfile" to "mapfile_save" with out telling me!!!!!!!!!!!!  This is why it would work on one site and not the other.
0
Ray PaseurCommented:
So you won't show us the var_dump() output we asked for?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.