Jump to content

HELP All my PhP worked... moved identical files to GoDaddy.. now its hosed


JTapp

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)) {

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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']);

Link to comment
Share on other sites

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 ...

Link to comment
Share on other sites

[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]

Link to comment
Share on other sites

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";
}?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.