Jump to content

JTapp

Members
  • Posts

    251
  • Joined

  • Last visited

Everything posted by JTapp

  1. Unfortunately, I have been asked to stop importing CSV data into phpMyAdmin and instead call on a file that sits on another IP address. My head hurts thinking about it. I have the IP address and I think the name of the file. But I really need to be pointed to API 101 or something. I'm at a complete loss.. Anybody able to give advice? <?php $username = "username"; $password = "password"; $hostname = "hostname"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("DB",$dbhandle) or die("Could not select DB"); $metode = mysql_real_escape_string($_POST['metode']); $search = mysql_real_escape_string($_POST['search']); $query = mysql_query("SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity, strLodgeMailingPostCode FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50"); while ($row = @mysql_fetch_array($query)) { echo "<tr bgcolor=\"#dddddd\"><td><center>"; echo $row["intLodgeNumber"]; echo "</center></td><td><center>"; echo ltrim($row["strLodgeName"], '0'); echo "</center></td><td><center><span class=\"style2\">"; echo "<input name=\"submit\" type=\"button\" value=\"Lodge Details\" onclick=\"javascript:window.location='http://www.customer.com/lodgelocator/3view.php?id="; echo $row["intLodgeNumber"]; echo "'\" /></center></td>"; echo "</center></td><td><center>"; echo ltrim($row["strLodgeLocationCity"], '0'); echo $row["strLodgeLocationCity"]; echo "</center></td><td><center>"; echo ltrim($row["intDistrictID"], '0'); }?>
  2. Scratch that last post. I said I was cross-eyed! I removed the input type lines that I don't need.
  3. Thanks mac_gyver.. I got a yippee! Then a whant whaaa.. I was reminded why I needed a 'hidden' input type So my search form looks the same but has new buttons below my main button.. I've called them 'wishthiswashidden'.. but regardless of what I do.. they are still visible. I'll keep playing (or butchering).. Thanks again. <form name="form1" method ="post" action="URL/results.php" target="_blank"> <table width="849" border="0" align="center"> <tr> <th width="812" bgcolor="#fff" class="form_1" scope="col"> <p class="style1"> <select name="metode" size="6"> <option value="strLodgeLocationCity"selected>City Lodge Is Located In</option> <option value="strLodgeName">Name of Lodge</option> <option value="intLodgeNumber">Lodge Number</option> <option value="intDistrictID">District Lodge Is In</option> <option value="strLodgeLocationZIP">Zip Code of Lodge Location</option> <option value="strLodgeCounty">Lodge County</option> </select> <span class="text_1">Search Value:</span><span class="copy_1"> <input name="search" type="text" class="form" size="25"> </span></p> <p class="heading_1"> <input type="submit" value="Click Here To Search Our Lodge Locator" name="Go"> </p> <p class="heading_1"> <input type="submit" name="metode" value="wishthiswashidden"/> <input type="Submit" name="metode" value="wishthiswashidden"/> </p> </p>
  4. Ok I think I see what you are saying, darkfreaks. So my form offers 6 choices on how to find the data. I have only been able to find success with one choice. A second choice returns data, but it is the wrong field. Certainly this makes no sense to whoever is reading this...
  5. Whew.... I check out the link you gave me.. its looking over my head.. but I always play around! I'll try to figure it out.. Thanks
  6. Oh.. here is the code for the form: <form name="form1" method ="post" action="websiteaddress.com/results.php" target="_blank"> <table width="849" border="0" align="center"> <tr> <th width="812" bgcolor="#fff" class="form_1" scope="col"> <p class="style1"> <select name="metode" size="6"> <option value="tblLodges.strLodgeLocationCity"selected>City Lodge Is Located In</option> <option value="tblLodges.strLodgeName">Name of Lodge</option> <option value="tblLodges.intLodgeNumber">Lodge Number</option> <option value="tblLodges.intDistrictID">District Lodge Is In</option> <option value="tblLodges.strLodgeLocationZIP">Zip Code of Lodge Location</option> <option value="tblLodges.strLodgeCounty">Lodge County</option> </select> <span class="text_1">Search Value:</span><span class="copy_1"> <input name="search" type="text" class="form" size="25"> </span></p> <p class="heading_1"> <input type="submit" value="Click Here To Search Our Lodge Locator" name="Go"> </p> <p class="heading_1"> <input type="hidden" name="metode" value="tblLodges.intDistrictID"/> <input type="hidden" name="metode" value="tblLodges.intLodgeNumber"/> </p> </p> <p class="style1"> </p> <p class="style1"> </p></th> </tr> </table> </form>
  7. I have a form that searches and subsequently returns data based on the field type selected. The end user can search by city, name, zip, district, county and ID number. Unfortunately I can't get it to trim. Meaning.. if the search term is '3', the return has been: 3, 13, 33, 321, etc.. when it should just return '3'. I have tried and tried, but so far I can only get one of my fields to work properly (intDistrictID). At this point I'm cross eyed Below is the code: <?php $username = "username"; $password = "password"; $hostname = "hostname"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("DB",$dbhandle) or die("Could not select DB"); $metode = mysql_real_escape_string($_POST['metode']); $search = mysql_real_escape_string($_POST['search']); $query = mysql_query("SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity, strLodgeMailingPostCode FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50"); while ($row = @mysql_fetch_array($query)) { echo "<tr bgcolor=\"#dddddd\"><td><center>"; echo $row["intLodgeNumber"]; echo "</center></td><td><center>"; echo ltrim($row["strLodgeName"], '0'); 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 ltrim($row["strLodgeLocationCity"], '0'); echo $row["strLodgeLocationCity"]; echo "</center></td><td><center>"; echo ltrim($row["intDistrictID"], '0'); }?>
  8. Thanks <table border="1" align="center" cellpadding="4" cellspacing="0"> <tr> <td colspan="5" bgcolor="#CD7427" height="18"><center spry:hover="headerintable"> <strong> Search Results</strong> </center></td> </tr> <tr> <td width="13%" height="18" align="center" bgcolor="#ffffff"><center> Lodge ID Number </center></td> <td width="19%" height="18" align="center" bgcolor="#ffffff"><center> Lodge Name </center></td> <td width="20%" align="center" bgcolor="#ffffff"> Click Button To View <strong>Lodge Details </strong></td> <td width="18%" height="18" align="center" bgcolor="#ffffff"><center> City </center></td> <td width="10%" height="18" align="center" bgcolor="#ffffff"><center> District Number </center></td> </tr> <?php $username = "*******"; $password = "******"; $hostname = "**********"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("********",$dbhandle) or die("Could not select **********"); $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"; }?> </table>
  9. <?php $username = "***********"; $password = "***********"; $hostname = "**********; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("*******",$dbhandle) or die("Could not select ******"); $id = $_GET['id']; $query = mysql_query("SELECT a.strLodgeName, a.intLodgeNumber, a.intDistrictID, a.strLodgeWEB, a.strLodgeCounty, a.dtChartered, a.strLodgeMeetingPlace, a.strLodgeLocationCity, a.strLodgeLocationState, a.strLodgeLocationZIP, a.strLodgeEmail, a.strLodgePhone, a.strLodgeFax, a.strDrivingDirectons, a.dtMeetingTime, a.strMeetingCodes, a.dtMealTime, a.strFloorSchool, a.strLodgeNews, a.strLodgePhotoPathAndName, b.strOfficerTitle, b.strFirstName, b.strLastName, b.BusinessPhone, b.PersEmail FROM tblLodges a LEFT JOIN tblOfficers b ON a.lngLodgeID = b.lngLodgeID WHERE a.intLodgeNumber=$id GROUP BY a.strLodgeName LIMIT 50")or die(mysql_error()); while ($row = @mysql_fetch_array($query)) { $variable1=$row["strLodgeName"]; $variable2=$row["intLodgeNumber"]; $variable3=$row["intDistrictID"]; $variable4=$row["strLodgeWEB"]; $variable5=$row["strLodgeCounty"]; $variable6=$row["dtChartered"]; $variable7=$row["strLodgeMeetingPlace"]; $variable8=$row["strLodgeLocationCity"]; $variable9=$row["strLodgeLocationState"]; $variable10=$row["strLodgeLocationZIP"]; $variable12=$row["strLodgeEmail"]; $variable13=$row["strLodgePhone"]; $variable14=$row["strLodgeFax"]; $variable15=$row["strDrivingDirectons"]; $variable16=$row["dtMeetingTime"]; $variable17=$row["dtMealTime"]; $variable18=$row["strFloorSchool"]; $variable19=$row["strLodgeNews"]; $variable20=$row["strLodgePhotoPathAndName"]; $variable21=$row["strMeetingCodes"]; $imagesFolder = '/lodgeimages/'; //table layout for results echo "<center>\n"; echo "<p><H2>Name of Lodge: $variable1</H2></p>"; if (file_exists($_SERVER['DOCUMENT_ROOT'].$imagesFolder.$row['intLodgeNumber'].".jpg")) { echo "<img src='" . $imagesFolder . $row['intLodgeNumber'] . ".jpg' /></p>"; } else { //just because it was on the end of your line... echo the </p> if no image echo "</p>"; } $file = $imagesFolder . $row['intLodgeNumber'] . '.jpg'; if (file_exists($file)){ echo "<img src='" . $imagesFolder . $row['intLodgeNumber'] . ".jpg' /></p>"; } else { echo "<img src='/Images/footerbar.GIF' /></p>"; } echo "<p><H2>Lodge Number: $variable2</H2></p>"; echo "<p><H2>District:</b> $variable3</p>"; echo ($variable4 != '') ? "<a href=\"$variable4\">Click Here To Go To The Lodge Website</a>" : ''; echo "<p><H2>Lodge County: $variable5</H2></p>"; echo "<p><H2>Lodge Chartered On: $variable6</H2></p>"; echo "<p><H2>Lodge Address: $variable7</H2></p>"; echo "<p><H2>$variable8 $variable9, $variable10</H2></p>"; echo ($variable12 != '') ? "<a href=\"mailto:$variable12\">Click Here To Email The Lodge</a>" : ''; echo "<p><H2>Lodge Phone Number: $variable13</H2></p>"; echo ($variable14 != '') ? "<p><H2>Lodge FAX Number: $variable14</H2></p>" : ''; echo "<p><H2>Lodge Driving Directions:</b><a href='http://maps.google.com/maps?saddr=&daddr=".$variable7.", ".$variable8.", ".$variable9."' target='_blank'>Link</a></p>"; echo ($variable21 != '') ? "<p><H2>Lodge Meetings: $variable21</H2></p>" : ''; echo ($variable16 != '') ? "<p><H2>Meeting Time: $variable16</H2></p>" : ''; echo ($variable17 != '') ? "<p><H2>Meal Time: $variable17</H2></p>" : ''; echo ($variable18 != '') ? "<p><H2>Lodge Floor School: $variable18</H2></p>" : ''; echo ($variable19 != '') ? "<p><H2>Lodge News: $variable19</H2></p>" : ''; echo "</center>\n"; } ?> </p> <hr> <p> <?php //query details table begins $query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.intDistrictID, tblLodges.strLodgeLocationCity, tblLodges.strLodgeLocationZIP, tblLodges.strLodgeCounty, tblOfficers.lngLodgeID, tblOfficers.strOfficerTitle, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE tblLodges.intLodgeNumber=$id GROUP BY tblOfficers.lngOfficerTitleID LIMIT 0, 50")or die(mysql_error()); echo "<center>\n"; echo "<H2>Roster of Lodge Officers</H2>\n"; echo "<table border='1'> <tr> <th>Lodge Number</th> <th>Officer Title</th> <th>Officer First</th> <th>Officer Last</th> <th>Officer Email</th> <th>Officer Phone</th> </tr>"; if (mysql_num_rows($query)) { while ($row = mysql_fetch_array($query)) { $variable1=$row["intLodgeNumber"]; $variable2=$row["strOfficerTitle"]; $variable3=$row["strFirstName"]; $variable4=$row["strLastName"]; $variable5=$row["PersEmail"]; $variable6=$row["BusinessPhone"]; //table layout for results print("<tr>"); echo "<tr align=\"center\" bgcolor=\"#EFEFEF\">\n"; echo "<td class=\"td_id\">$variable1</td>\n"; echo "<td class=\"td_id\">$variable2</td>\n"; echo "<td class=\"td_id\">$variable3</td>\n"; echo "<td class=\"td_id\">$variable4</td>\n"; echo "<td class='td_id'><a href='mailto:". $variable5. "'>". $variable5. "</a></td>\n"; echo "<td class=\"td_id\">$variable6</td>\n"; print("</tr>"); } } ?> <p> </p>
  10. Hey Ken: <form name="form1" method ="post" action="http://www.gloklahoma.com/lodgelocator/3results.php" target="_blank"> <table width="849" border="0" align="center"> <tr> <th width="812" bgcolor="#fff" class="form_1" scope="col"> <p class="style1"><img src="../images/lodgelocator.jpg" width="478" height="176"></p> <p class="style1"><img src="../images/line.gif" width="327" height="23"></p> <p class="text_1"><a href="9results.php">Click Here For A List Of Lodges</a></p> <p class="style1"> <select name="metode" size="6"> <option value="tblLodges.strLodgeName" selected>Name of Lodge</option> <option value="tblLodges.intLodgeNumber">Lodge Number</option> <option value="tblLodges.intDistrictID">District Lodge Is In</option> <option value="tblLodges.%strLodgeLocationCity">City Lodge Is Located In</option> <option value="tblLodges.strLodgeLocationZIP">Zip Code of Lodge Location</option> <option value="tblLodges.strLodgeCounty">Lodge County</option> </select> <span class="text_1">Search Value:</span><span class="copy_1"> <input name="search" type="text" class="form" size="25"> </span> </p> <p class="style1"> <input type="submit" value="Click Here To Search Our Lodge Locator!!" name="GOTWO2"> </p> <p class="style1"> </p> <p class="style1"> </p></th> </tr> </table> </form>
  11. I'm struggling with a % wildcard. Specifically.. the line item that has "City Lodge is Located In".. is not reporting "Oklahoma City" if the person types "Oklahoma". Can anybody help me with a quick fix on wildcard functionality? <select name="metode" size="6"> <option value="tblLodges.strLodgeName" selected>Name of Lodge</option> <option value="tblLodges.intLodgeNumber">Lodge Number</option> <option value="tblLodges.intDistrictID">District Lodge Is In</option> <option value="tblLodges.strLodgeLocationCity">City Lodge Is Located In</option> <option value="tblLodges.strLodgeLocationZIP">Zip Code of Lodge Location</option> <option value="tblLodges.strLodgeCounty">Lodge County</option>
  12. 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"; }?>
  13. 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
  14. 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)) {
  15. 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.
  16. 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.
  17. Ok - The information I am getting is too scattered for me to piece together. It sounds like there is a big effort to change the way beginners like me are coding things. But my non-industry standard code worked - it is still working on a new server and it took me a lot of pain to get there. I am coping my code for another client and their server seems to be more standardized so I can't just import it. I feel like I'm being told "Its not compliant" - but "Go figure it out" Can somebody PLEASE tell me specifically how to fix the following code so it is not speaking to registry globals? </tr> <?php $username = "xxxxxxxx"; $password = "xxxxxxxxx"; $hostname = "xxxxx"; $dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL"); $selected = mysql_select_db("xxxxxxxxx",$dbhandle) or die("Could not select xxxxxxx"); $query = mysql_query("SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity, strLodgeLocationZIP FROM tblLodges WHERE TRIM(LEADING '0' FROM $metode) = '$search' GROUP BY strLodgeName LIMIT 50"); while ($row = @mysql_fetch_array($query)) { 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.mywebsiteaddress.org/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'); }?>
  18. Sorry... I've been playing with this through the night. And please bear with me...because I am also still quite the beginner - I am spending as much time trying to understand your posts as I am trying to tweak the code. Here is my latest attempt $metode = mysql_real_escape_string($_POST['metode']); $search = mysql_real_escape_string($_POST['search']); $query = mysql_query("SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity, strLodgeLocationZIP FROM tblLodges WHERE TRIM(LEADING '0') = '$search' GROUP BY strLodgeName LIMIT 50"); while ($row = @mysql_fetch_array($query)) $sql = "SELECT strLodgeName, intLodgeNumber, intDistrictID, strLodgeLocationCity FROM tblLodges WHERE TRIM(LEADING '0' FROM $_POST['metode']) = $_POST['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"; }?>
  19. OK - thanks for the clarification. But I still can't assess if my code is completely hosed or if I just need to add a line or two.
×
×
  • 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.