nipsilanti Posted March 10, 2009 Share Posted March 10, 2009 Please Help, I have been running mysql and php5 on a remote host for the past year without any problems. I recently built my own server in-house with the following specs. Ubuntu 8.10 64bit, mysql5.0.67, Apache2.2.9, php5.2.6-2 and phpmyadmin2.11.8.1deb1. My php code that works on the remote server no longer performs the proper query on my server. Goal of my php code is to query test data by (site),(pressure) and (clampType). (Site) and (clampType) work fine. I used a $_Get to capture the sort criteria but it seems to ignore pressure altogether. It is outputting to the url fine but the query ignores it. Any thoughts would be greatly appreciated. I believe the problem is configuration related and not code related but any expert thoughts in the matter would be greatly appreciated. Attached is the code. I already tried using the php.ini file from the remote site. That didn't work. $connection = mysql_connect($host, $user, $pass, $dbb); $link = mysql_select_db($dbb,$connection) or die(mysql_error()); switch ($link) { case TRUE: echo "Connected ThankYou..."; break; case FALSE: echo "Not Connected"; } if(isset($_GET['db'])){ $db = $_GET['db']; } if(isset($_GET['clampID'])){ $clampID = $_GET['clampID']; } if(isset($_GET['clampType'])){ $clampType = $_GET['clampType']; } if(isset($_GET['limit'])){ $limit = $_GET['limit']; } if(isset($_GET['Pressure'])){ $pressure = $_GET['Pressure']; } //New Code to include clampType in query *** else if(!isset($clampID)&& isset($pressure)&& isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE Pressure = '$pressure' AND clampType = '$clampType' ORDER BY $db.Date, $db.clampID"; } else if(isset($clampID)&& !isset($pressure)&& isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE clampID = '$clampID' AND clampType = '$clampType' ORDER BY $db.Date, $db.clampID"; } else if(isset($clampID)&& isset($pressure)&& !isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE clampID = '$clampID' AND Pressure = '$pressure' ORDER BY $db.Date, $db.clampID"; } else if(!isset($clampID)&& !isset($pressure)&& isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE clampType = '$clampType' ORDER BY $db.Date, $db.clampID"; } else if(isset($clampID)&& !isset($pressure)&& !isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE clampID = '$clampID' ORDER BY $db.Date, $db.clampID"; } else if(!isset($clampID)&& isset($pressure)&& !isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE Pressure = '$pressure' ORDER BY $db.Date, $db.clampID"; } else if(isset($clampID)&& isset($pressure)&& isset($clampType)){ $queryString = "SELECT *, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db WHERE clampID = '$clampID' AND Pressure = '$pressure' AND clampType = '$clampType' ORDER BY $db.Date, $db.clampID"; } else{ $queryString = "SELECT*, WtUB/TotalWt*100 AS pUB, WtUF/TotalWt*100 AS pUF, WtLB/TotalWt*100 AS pLB, WtLF/TotalWt*100 AS pLF FROM $db ORDER BY $db.Date, $db.clampID"; } $result = mysql_query($queryString, $connection); $num=mysql_numrows($result); echo $num; mysql_close(); Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/ Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 are you sure you can use the same name, for all the query's and then only use one mysql_query() for all query's. never seen that before. how it going to no what query has a fault. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780920 Share on other sites More sharing options...
PFMaBiSmAd Posted March 10, 2009 Share Posted March 10, 2009 What exactly is the symptom that leads you to believe that the pressure is being ignored? What result are you getting vs what do you expect? Have you echoed $queryString to see what it contains? Add the following two lines immediately after your first opening <?php tag - ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780921 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 Hi, Yes this code works fine. It is just something to do with my php configuration. Thanks for the reply.. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780923 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 I have an html form with drop down list for each selection criteria. The user can pick the site, the pressure, and the clamp type. The user then submits the data and it goes to my php file. My $_get function puts it in the url: fpull_color2_ctype_wtf1_09.php?db=whr_ga_lithia_springs_r432&pressure=H&clampType=A I can try all the combinations and it produces the same result whether I select a pressure or not. Historically the program would not run my query unless a pressure was selected. That is why I believe the problem is isolated to the pressure variable. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780925 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 Hi PF..... I put the code in as you instructed. Where might I see the analysis? My program just outputs the query results as a html table. No errors were echo'd in the process. Thanks for the education.. much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780931 Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 have you tried to echo out all the $_GET[''] to see if the result is correct. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780934 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 Hi Redarrow, Actually my code only runs 1 query option at a time and loops through all the data. See the attached php file. It is a little easier to see. Thanks, [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780936 Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 There not one mistake what i can see very strange i say.... wonder what different from the two php.ini settings then that very strange. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780937 Share on other sites More sharing options...
.josh Posted March 10, 2009 Share Posted March 10, 2009 If your other vars being passed via GET are working fine, chances are, you mispelled 'Pressure' in your form or link, wherever the vars are being passed from. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780938 Share on other sites More sharing options...
redarrow Posted March 10, 2009 Share Posted March 10, 2009 Post your link please cheers. Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780941 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 Hi Everyone, I think it would be easier to explain if I just provided the link. Try it out and see the error. Select Findlay and submit. Back up and Select Findlay and H for high pressure. (You get the same result) http://nipsilanti.homelinux.org/process_form_color2_ctype_wtf1_09.html Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780942 Share on other sites More sharing options...
nipsilanti Posted March 10, 2009 Author Share Posted March 10, 2009 Hi Everyone, I have attached both php.ini files. I tried replacing the php.ini.original = the bad one with php.ini1 and the result was the same. I'll continue to play with it until the problem is solved and post my findings. Thanks everyone for their help and I'll let you know how it turns out. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-780948 Share on other sites More sharing options...
nipsilanti Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks all for the echo option to see what was passing. I echo'd from my HTML page and figured out the $GET method was no passing my 3rd variable. I switched to the $POST method and everything worked fine. I'm up and running and all is good. I just don't understand why the $GET method is flushed on later versions of php5. Is this is a config issue? Thanks for the advice and all the help... I hope to return the favor in the future. Quote: PHP and MYSQL truly shows computing Horse Power... Skip the GUI BS.... Nipsilanti (Was a great Town)RIPB3 Quote Link to comment https://forums.phpfreaks.com/topic/148725-solved-same-php-code-run-on-2-different-lamp-servers-i-get-different-results/#findComment-785564 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.