JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 You need to define $metode & $search. This can be done by placing the following just before your query. $metode = mysql_real_escape_string($POST['metode']); $search = mysql_real_escape_string($POST['search']); It sounds like there is a big effort to change the way beginners like me are coding things. I'm really not sure where your learning from but register globals has been off by default in php installation for over 8 years. This members to this site helped me to create the code.. if you check out my history, you can see the development of my code. Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986949 Share on other sites More sharing options...
JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 You need to define $metode & $search. This can be done by placing the following just before your query. $metode = mysql_real_escape_string($POST['metode']); $search = mysql_real_escape_string($POST['search']); It sounds like there is a big effort to change the way beginners like me are coding things. I'm really not sure where your learning from but register globals has been off by default in php installation for over 8 years. I pasted this and it did not return any results. Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986951 Share on other sites More sharing options...
JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 The error message is as follows: Parse error: syntax error, unexpected T_IF in /home/content/62/5287962/html/lodgelocator/3results.php on line 573 Lines 572-574 are: $sql = "SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50" if ($results = mysql_query($sql)) { if (mysql_num_rows($results)) { Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986953 Share on other sites More sharing options...
trq Posted January 2, 2010 Share Posted January 2, 2010 Your missing the closing semi-colon on the $sql line. Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986955 Share on other sites More sharing options...
JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 Thought I fixed that semi.. thanks! Below is the actual error - which I posted a couple of days ago.. we've come full circle. Your response to this error was: "Now were getting somewhere. $metode & $search are empty. Where are these variables defined?" Query failed You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') = '' GROUP BY strLodgeName LIMIT 50' at line 1 SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE TRIM(LEADING '0' FROM ) = '' GROUP BY strLodgeName LIMIT 50 Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986956 Share on other sites More sharing options...
trq Posted January 2, 2010 Share Posted January 2, 2010 Can we once again see all your code? Looks like $metode & $search are still not defined. Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986972 Share on other sites More sharing options...
trq Posted January 2, 2010 Share Posted January 2, 2010 Actually, I see why. Typo on my behalf. $metode = mysql_real_escape_string($POST['metode']); $search = mysql_real_escape_string($POST['search']); should be.... $metode = mysql_real_escape_string($_POST['metode']); $search = mysql_real_escape_string($_POST['search']); Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986973 Share on other sites More sharing options...
PFMaBiSmAd Posted January 2, 2010 Share Posted January 2, 2010 Several pieces of helpful advice have been posted in this thread that would shorten this process - And if you develop and debug your code on a system with error_reporting set to E_ALL and display_errors set to ON in your php.ini, php will help you ... Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-986975 Share on other sites More sharing options...
zq29 Posted January 2, 2010 Share Posted January 2, 2010 [ot]Tip: It's definitely worth configuring your local (W|L)AMP stack to match that of your production server, that way, anything that works locally should also work live without any problems. Try to install the same versions of Apache Web Server, MySQL and PHP as is installed on your production server, if possible. I appreciate that there are minor differences if your server is Linux based and you're running Windows locally - But match up as much as you can.[/ot] Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-987062 Share on other sites More sharing options...
JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 Latest Code is as follows <?php $username = "xxxxxxx"; $password = "xxxxxxxxxx"; $hostname = "xxxxxxxxxxxxx"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("xxxxx",$dbhandle) or die("Could not select xxxxxxx"); $metode = mysql_real_escape_string($_POST['metode']); $search = mysql_real_escape_string($_POST['search']); $sql = "SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50"; if ($results = mysql_query($sql)) { if (mysql_num_rows($results)) { while ($row = mysql_fetch_assoc($results)) { echo "<tr bgcolor=\"#dddddd\"><td><center>"; echo $row["intLodgeNumber"]; echo "</center></td><td><center>"; echo $row["strLodgeName"]; echo "</center></td><td><center><span class=\"style2\">"; echo "<input name=\"submit\" type=\"button\" value=\"Lodge Details\" onclick=\"javascript:window.location='http://www.gloklahoma.com/lodgelocator/3view.php?id="; echo $row["intLodgeNumber"]; echo "'\" /></center></td>"; echo "</center></td><td><center>"; echo $row["strLodgeLocationCity"]; echo "</center></td><td><center>"; echo ltrim($row["intDistrictID"], '0'); } } else { echo "No records found"; } } else { echo "Query failed<br >" . mysql_error() . "<br>$sql"; }?> Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-987169 Share on other sites More sharing options...
JTapp Posted January 2, 2010 Author Share Posted January 2, 2010 I MARKED THIS SOLVED. THANK YOU THORPE! Quote Link to comment https://forums.phpfreaks.com/topic/186763-help-all-my-php-worked-moved-identical-files-to-godaddy-now-its-hosed/page/2/#findComment-987171 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.