We help IT Professionals succeed at work.
Get Started

Problem with code between 2 diffrent sites with mysql fetch

breeze351
breeze351 asked
on
61 Views
Last Modified: 2015-08-02
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!!!
Comment
Watch Question
Fixer of Problems
CERTIFIED EXPERT
Most Valuable Expert 2014
Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE