imperialized Posted July 25, 2009 Share Posted July 25, 2009 Ok guys, I am completely confused as to why this isnt working.. I've tried everything so I post it here. $their_country = $x[location]; $country = mysql_query("SELECT * FROM countries ORDER BY id ASC"); while($z = mysql_fetch_array($country)){ $current_country = $z[country]; if($their_country <> $current_country){ //not theirs print "<option value=\"$current_country\">$current_country</option>"; } else { //theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } } $their_country = prints France (which is good) $current_country = prints whichever is pulled from the database in the loop (good too) tried just using the $x[location] and $z[country] to compare, fails. tried using === to compare, fails tried putting quotes around each string in the if statement, fails -- The code itself works, it just doesn't select the country. When (View Source) no option in the <select> menu has the SELECTED tag added to it. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/ Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 so where is $x[location] being set? Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882816 Share on other sites More sharing options...
lonewolf217 Posted July 25, 2009 Share Posted July 25, 2009 i wouldn't think that <> would take into account a case insensitive check. try using strcasecmp() to see if it makes a difference. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882818 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 if(strcasecmp($their_country,$current_country) <> 0){ //not theirs print "<option value=\"$current_country\">$current_country</option>"; } else { //theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } Still does not work.. $x[location] is set prior when I query the account info. //Get all of their account information. $get_account_query = mysql_query("SELECT * FROM poker_users WHERE poker_name = '$poker_name' LIMIT 1;"); //Make sure the account exists if(mysql_num_rows($get_account_query) > 0){ //Account exists, make a loop! $x = mysql_fetch_assoc($get_account_query); However, both of the variables print as they should... just wont compare correctly? Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882820 Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 with strcasecmp you want to see if it equals zero. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882821 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 with strcasecmp you want to see if it equals zero. Tried it both ways, makes no difference, although the reason I use <> is b/c the if statement decides which to print. if its not 0, its not the same. while($z = mysql_fetch_array($country)){ $current_country = $z[country]; if(strcasecmp($their_country,$current_country) == 0){ //not theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their print "<option value=\"$current_country\">$current_country</option>"; } Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882825 Share on other sites More sharing options...
lonewolf217 Posted July 25, 2009 Share Posted July 25, 2009 the only thing i can think of offhand would be trailing spaces or something in your data. try doing this <?php var_dump($their_country); // put this before the while loop var_dump($current_country); // put this inside the while loop ?> Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882826 Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 hmmm.... do this: while($z = mysql_fetch_array($country)){ $current_country = $z[country]; echo $their_country . " : " . $current_country . "<br/>"; if(strcasecmp($their_country,$current_country) == 0){ //not theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their print "<option value=\"$current_country\">$current_country</option>"; } post what that echo echoes out. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882827 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 hmmm.... do this: while($z = mysql_fetch_array($country)){ $current_country = $z[country]; echo $their_country . " : " . $current_country . "<br/>"; if(strcasecmp($their_country,$current_country) == 0){ //not theirs print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their print "<option value=\"$current_country\">$current_country</option>"; } post what that echo echoes out. I had to comment out the <select> in order to print the vars (cant print them inside, you know what im saying. but here is the result) France : United States France : Afghanistan France : Albania France : Algeria France : American Samoa France : Andorra France : Angola France : Anguilla France : Antarctica France : Antigua and Barbuda France : Argentina France : Armenia France : Aruba France : Austria France : Azerbaijan France : Bahamas France : Bahrain France : Bangladesh France : Barbados France : Belarus France : Belgium France : Belize France : Benin France : Bermuda France : Bhutan France : Bolivia France : Bosnia and Herzegowina France : Botswana France : Bouvet Island France : Brazil France : British Indian Ocean Terr. France : Brunei Darussalam France : Bulgaria France : Burkina Faso France : Burundi France : Cambodia France : Cameroon France : Cape Verde France : Cayman Islands France : Central African Republic France : Chad France : Chile France : China France : Christmas Island France : Cocos (Keeling) Islands France : Colombia France : Comoros France : Congo France : Cook Islands France : Costa Rica France : Croatia (Hrvatska) France : Cuba France : Cyprus France : Czech Republic France : Denmark France : Djibouti France : Dominica France : Dominican Republic France : East Timor France : Ecuador France : Egypt France : El Salvador France : Equatorial Guinea France : Eritrea France : Estonia France : Ethiopia France : Falkland Islands/Malvinas France : Faroe Islands France : Fiji France : Finland France : France France : France, Metropolitan France : French Guiana France : French Polynesia France : French Southern Terr. France : Gabon France : Gambia France : Georgia France : Germany France : Ghana France : Gibraltar France : Greece France : Greenland France : Grenada France : Guadeloupe France : Guam France : Guatemala France : Guinea France : Guinea-Bissau France : Guyana France : Haiti France : Heard & McDonald Is. France : Honduras France : Hong Kong France : Hungary France : Iceland France : India France : Indonesia France : Iran France : Iraq France : Ireland France : Israel France : Italy France : Jamaica France : Japan France : Jordan France : Kazakhstan France : Kenya France : Kiribati France : South Korea France : Kuwait France : Kyrgyzstan France : Latvia France : Lebanon France : Lesotho France : Liberia France : Libyan Arab Jamahiriya France : Liechtenstein France : Lithuania France : Luxembourg France : Macau France : Macedonia France : Madagascar France : Malawi France : Malaysia France : Maldives France : Mali France : Malta France : Marshall Islands France : Martinique France : Mauritania France : Mauritius France : Mayotte France : Mexico France : Micronesia France : Moldova France : Monaco France : Mongolia France : Montserrat France : Morocco France : Mozambique France : Myanmar France : Namibia France : Nauru France : Nepal France : Netherlands France : Netherlands Antilles France : New Caledonia France : New Zealand France : Nicaragua France : Niger France : Nigeria France : Niue France : Norfolk Island France : Northern Mariana Is. France : Norway France : Oman France : Pakistan France : Palau France : Panama France : Papua New Guinea France : Paraguay France : Peru France : Philippines France : Pitcairn France : Poland France : Portugal France : Puerto Rico France : Qatar France : Reunion France : Romania France : Russian Federation France : Rwanda France : Saint Kitts and Nevis France : Saint Lucia France : Samoa France : San Marino France : Sao Tome & Principe France : Saudi Arabia France : Senegal France : Seychelles France : Sierra Leone France : Singapore France : Slovakia France : Slovenia France : Solomon Islands France : Somalia France : South Africa France : Spain France : Sri Lanka France : St. Helena France : Sudan France : Suriname France : Swaziland France : Sweden France : Switzerland France : Syrian Arab Republic France : Taiwan France : Tajikistan France : Tanzania France : Thailand France : Togo France : Tokelau France : Tonga France : Trinidad and Tobago France : Tunisia France : Turkey France : Turkmenistan France : Tuvalu France : Uganda France : Ukraine France : United Arab Emirates France : United Kingdom France : U.S. Minor Outlying Is. France : Uruguay France : Uzbekistan France : Vanuatu France : Vatican France : Venezuela France : Viet Nam France : Virgin Islands (British) France : Virgin Islands (U.S.) France : Western Sahara France : Yemen France : Yugoslavia France : Zaire France : Zambia France : Zimbabwe Code $their_country = $x[location]; $country = mysql_query("SELECT * FROM countries ORDER BY id ASC"); while($z = mysql_fetch_array($country)){ $current_country = $z[country]; echo $their_country . " : " . $current_country . "<br/>"; if(strcasecmp($their_country,$current_country) == 0){ //not theirs //print "<option value=\"$current_country\" SELECTED>$current_country</option>"; } else { //their //print "<option value=\"$current_country\">$current_country</option>"; } } Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882831 Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 Yeah I'm suspecting the same thing as lonewolf: Some errant spacing or newline or tab char or something. Do this: if(strcasecmp(trim($their_country),trim($current_country)) == 0){ That should hopefully do the trick. If so, I recommend you backtrack in your script to where they are being put in the db in and trim them going into the db instead, though. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882839 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 Yeah I'm suspecting the same thing as lonewolf: Some errant spacing or newline or tab char or something. Do this: if(strcasecmp(trim($their_country),trim($current_country)) == 0){ That should hopefully do the trick. If so, I recommend you backtrack in your script to where they are being put in the db in and trim them going into the db instead, though. if(strcasecmp(trim($their_country),trim($current_country)) == 0){ Same thing, prints the list but doesnt select. This is driving me crazy! I've never had a problem like this before. I put the countries into the database using this txt file countries.txt (when highlighted, no spaces are shown at the end of lines) United Kingdom United States Australia New Zealand Canada France South Africa Afghanistan Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua and Barbuda Argentina Armenia Aruba Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia and Herzegowina Botswana Bouvet Island Brazil British Indian Ocean Terr. Brunei Darussalam Bulgaria Burkina Faso Burundi Cambodia Cameroon Cape Verde Cayman Islands Central African Republic Chad Chile China Christmas Island Cocos (Keeling) Islands Colombia Comoros Congo Cook Islands Costa Rica Cote d'Ivoire Croatia (Hrvatska) Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Eritrea Estonia Ethiopia Falkland Islands/Malvinas Faroe Islands Fiji Finland France France, Metropolitan French Guiana French Polynesia French Southern Terr. Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guinea Guinea-Bissau Guyana Haiti Heard & McDonald Is. Honduras Hong Kong Hungary Iceland India Indonesia Iran Iraq Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati South Korea Kuwait Kyrgyzstan Lao People's Dem. Rep. Latvia Lebanon Lesotho Liberia Libyan Arab Jamahiriya Liechtenstein Lithuania Luxembourg Macau Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Mexico Micronesia Moldova Monaco Mongolia Montserrat Morocco Mozambique Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niger Nigeria Niue Norfolk Island Northern Mariana Is. Norway Oman Pakistan Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Reunion Romania Russian Federation Rwanda Saint Kitts and Nevis Saint Lucia Samoa San Marino Sao Tome & Principe Saudi Arabia Senegal Seychelles Sierra Leone Singapore Slovakia Slovenia Solomon Islands Somalia South Africa Spain Sri Lanka St. Helena Sudan Suriname Swaziland Sweden Switzerland Syrian Arab Republic Taiwan Tajikistan Tanzania Thailand Togo Tokelau Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan Tuvalu Uganda Ukraine United Arab Emirates United Kingdom U.S. Minor Outlying Is. Uruguay Uzbekistan Vanuatu Vatican Venezuela Viet Nam Virgin Islands (British) Virgin Islands (U.S.) Western Sahara Yemen Yugoslavia Zaire Zambia Zimbabwe When putting them into the database, it uses this: <SELECT NAME="location" id="country_id" SIZE="1"> <OPTION VALUE="1"> Choose One </OPTION> <OPTION VALUE="United Kingdom">United Kingdom</OPTION> <OPTION VALUE="United States">United States</OPTION> <OPTION VALUE="Australia">Australia</OPTION> <OPTION VALUE="New Zealand">New Zealand</OPTION> <OPTION VALUE="Canada">Canada</OPTION> <OPTION VALUE="France">France</OPTION> <OPTION VALUE="South Africa">South Africa</OPTION> <OPTION VALUE="Afghanistan">Afghanistan</OPTION> <OPTION VALUE="Albania">Albania</OPTION> <OPTION VALUE="Algeria">Algeria</OPTION> <OPTION VALUE="American Samoa">American Samoa</OPTION> <OPTION VALUE="Andorra">Andorra</OPTION> <OPTION VALUE="Angola">Angola</OPTION> <OPTION VALUE="Anguilla">Anguilla</OPTION> <OPTION VALUE="Antarctica">Antarctica</OPTION> <OPTION VALUE="Antigua and Barbuda">Antigua and Barbuda</OPTION> <OPTION VALUE="Argentina">Argentina</OPTION> <OPTION VALUE="Armenia">Armenia</OPTION> <OPTION VALUE="Aruba">Aruba</OPTION> <OPTION VALUE="Austria">Austria</OPTION> <OPTION VALUE="Azerbaijan">Azerbaijan</OPTION> <OPTION VALUE="Bahamas">Bahamas</OPTION> <OPTION VALUE="Bahrain">Bahrain</OPTION> <OPTION VALUE="Bangladesh">Bangladesh</OPTION> <OPTION VALUE="Barbados">Barbados</OPTION> <OPTION VALUE="Belarus">Belarus</OPTION> <OPTION VALUE="Belgium">Belgium</OPTION> <OPTION VALUE="Belize">Belize</OPTION> <OPTION VALUE="Benin">Benin</OPTION> <OPTION VALUE="Bermuda">Bermuda</OPTION> <OPTION VALUE="Bhutan">Bhutan</OPTION> <OPTION VALUE="Bolivia">Bolivia</OPTION> <OPTION VALUE="Bosnia and Herzegowina">Bosnia and Herzegowina</OPTION> <OPTION VALUE="Botswana">Botswana</OPTION> <OPTION VALUE="Bouvet Island">Bouvet Island</OPTION> <OPTION VALUE="Brazil">Brazil</OPTION> <OPTION VALUE="British Indian Ocean Terr.">British Indian Ocean Terr.</OPTION> <OPTION VALUE="Brunei Darussalam">Brunei Darussalam</OPTION> <OPTION VALUE="Bulgaria">Bulgaria</OPTION> <OPTION VALUE="Burkina">Burkina Faso</OPTION> <OPTION VALUE="Burundi">Burundi</OPTION> <OPTION VALUE="Cambodia">Cambodia</OPTION> <OPTION VALUE="Cameroon">Cameroon</OPTION> <OPTION VALUE="Cape Verde">Cape Verde</OPTION> <OPTION VALUE="Cayman Islands">Cayman Islands</OPTION> <OPTION VALUE="Central African Republic">Central African Republic</OPTION> <OPTION VALUE="Chad">Chad</OPTION> <OPTION VALUE="Chile">Chile</OPTION> <OPTION VALUE="China">China</OPTION> <OPTION VALUE="Christmas Island">Christmas Island</OPTION> <OPTION VALUE="Cocos (Keeling) Islands">Cocos (Keeling) Islands</OPTION> <OPTION VALUE="Colombia">Colombia</OPTION> <OPTION VALUE="Comoros">Comoros</OPTION> <OPTION VALUE="Congo">Congo</OPTION> <OPTION VALUE="Cook Islands">Cook Islands</OPTION> <OPTION VALUE="Costa Rica">Costa Rica</OPTION> <OPTION VALUE="Cote d'Ivoire">Cote d'Ivoire</OPTION> <OPTION VALUE="Croatia (Hrvatska)">Croatia (Hrvatska)</OPTION> <OPTION VALUE="Cuba">Cuba</OPTION> <OPTION VALUE="Cyprus">Cyprus</OPTION> <OPTION VALUE="Czech Republic">Czech Republic</OPTION> <OPTION VALUE="Denmark">Denmark</OPTION> <OPTION VALUE="Djibouti">Djibouti</OPTION> <OPTION VALUE="Dominica">Dominica</OPTION> <OPTION VALUE="Dominican Republic">Dominican Republic</OPTION> <OPTION VALUE="East Timor">East Timor</OPTION> <OPTION VALUE="Ecuador">Ecuador</OPTION> <OPTION VALUE="Egypt">Egypt</OPTION> <OPTION VALUE="El Salvador">El Salvador</OPTION> <OPTION VALUE="Equatorial Guinea">Equatorial Guinea</OPTION> <OPTION VALUE="Eritrea">Eritrea</OPTION> <OPTION VALUE="Estonia">Estonia</OPTION> <OPTION VALUE="Ethiopia">Ethiopia</OPTION> <OPTION VALUE="Falkland Islands/Malvinas">Falkland Islands/Malvinas</OPTION> <OPTION VALUE="Faroe Islands">Faroe Islands</OPTION> <OPTION VALUE="Fiji">Fiji</OPTION> <OPTION VALUE="Finland">Finland</OPTION> <OPTION VALUE="France">France</OPTION> <OPTION VALUE="France, Metropolitan">France, Metropolitan</OPTION> <OPTION VALUE="French Guiana">French Guiana</OPTION> <OPTION VALUE="French Polynesia">French Polynesia</OPTION> <OPTION VALUE="French Southern Terr.">French Southern Terr.</OPTION> <OPTION VALUE="Gabon">Gabon</OPTION> <OPTION VALUE="Gambia">Gambia</OPTION> <OPTION VALUE="Georgia">Georgia</OPTION> <OPTION VALUE="Germany">Germany</OPTION> <OPTION VALUE="Ghana">Ghana</OPTION> <OPTION VALUE="Gibraltar">Gibraltar</OPTION> <OPTION VALUE="Greece">Greece</OPTION> <OPTION VALUE="Greenland">Greenland</OPTION> <OPTION VALUE="Grenada">Grenada</OPTION> <OPTION VALUE="Guadeloupe">Guadeloupe</OPTION> <OPTION VALUE="Guam">Guam</OPTION> <OPTION VALUE="Guatemala">Guatemala</OPTION> <OPTION VALUE="Guinea">Guinea</OPTION> <OPTION VALUE="Guinea-Bissau">Guinea-Bissau</OPTION> <OPTION VALUE="Guyana">Guyana</OPTION> <OPTION VALUE="Haiti">Haiti</OPTION> <OPTION VALUE="Heard & McDonald Is.">Heard & McDonald Is.</OPTION> <OPTION VALUE="Honduras">Honduras</OPTION> <OPTION VALUE="Hong Kong">Hong Kong</OPTION> <OPTION VALUE="Hungary">Hungary</OPTION> <OPTION VALUE="Iceland">Iceland</OPTION> <OPTION VALUE="India">India</OPTION> <OPTION VALUE="Indonesia">Indonesia</OPTION> <OPTION VALUE="Iran">Iran</OPTION> <OPTION VALUE="Iraq">Iraq</OPTION> <OPTION VALUE="Ireland">Ireland</OPTION> <OPTION VALUE="Israel">Israel</OPTION> <OPTION VALUE="Italy">Italy</OPTION> <OPTION VALUE="Jamaica">Jamaica</OPTION> <OPTION VALUE="Japan">Japan</OPTION> <OPTION VALUE="Jordan">Jordan</OPTION> <OPTION VALUE="Kazakhstan">Kazakhstan</OPTION> <OPTION VALUE="Kenya">Kenya</OPTION> <OPTION VALUE="Kiribati">Kiribati</OPTION> <OPTION VALUE="South Korea">South Korea</OPTION> <OPTION VALUE="Kuwait">Kuwait</OPTION> <OPTION VALUE="Kyrgyzstan">Kyrgyzstan</OPTION> <OPTION VALUE="Lao People's Dem. Rep.">Lao People's Dem. Rep.</OPTION> <OPTION VALUE="Latvia">Latvia</OPTION> <OPTION VALUE="Lebanon">Lebanon</OPTION> <OPTION VALUE="Lesotho">Lesotho</OPTION> <OPTION VALUE="Liberia">Liberia</OPTION> <OPTION VALUE="Libyan Arab Jamahiriya">Libyan Arab Jamahiriya</OPTION> <OPTION VALUE="Liechtenstein">Liechtenstein</OPTION> <OPTION VALUE="Lithuania">Lithuania</OPTION> <OPTION VALUE="Luxembourg">Luxembourg</OPTION> <OPTION VALUE="Macau">Macau</OPTION> <OPTION VALUE="Macedonia">Macedonia</OPTION> <OPTION VALUE="Madagascar">Madagascar</OPTION> <OPTION VALUE="Malawi">Malawi</OPTION> <OPTION VALUE="Malaysia">Malaysia</OPTION> <OPTION VALUE="Maldives">Maldives</OPTION> <OPTION VALUE="Mali">Mali</OPTION> <OPTION VALUE="Malta">Malta</OPTION> <OPTION VALUE="Marshall Islands">Marshall Islands</OPTION> <OPTION VALUE="Martinique">Martinique</OPTION> <OPTION VALUE="Mauritania">Mauritania</OPTION> <OPTION VALUE="Mauritius">Mauritius</OPTION> <OPTION VALUE="Mayotte">Mayotte</OPTION> <OPTION VALUE="Mexico">Mexico</OPTION> <OPTION VALUE="Micronesia">Micronesia</OPTION> <OPTION VALUE="Moldova">Moldova</OPTION> <OPTION VALUE="Monaco">Monaco</OPTION> <OPTION VALUE="Mongolia">Mongolia</OPTION> <OPTION VALUE="Montserrat">Montserrat</OPTION> <OPTION VALUE="Morocco">Morocco</OPTION> <OPTION VALUE="Mozambique">Mozambique</OPTION> <OPTION VALUE="Myanmar">Myanmar</OPTION> <OPTION VALUE="Namibia">Namibia</OPTION> <OPTION VALUE="Nauru">Nauru</OPTION> <OPTION VALUE="Nepal">Nepal</OPTION> <OPTION VALUE="Netherlands">Netherlands</OPTION> <OPTION VALUE="Netherlands Antilles">Netherlands Antilles</OPTION> <OPTION VALUE="New Caledonia">New Caledonia</OPTION> <OPTION VALUE="New Zealand">New Zealand</OPTION> <OPTION VALUE="Nicaragua">Nicaragua</OPTION> <OPTION VALUE="Niger">Niger</OPTION> <OPTION VALUE="Nigeria">Nigeria</OPTION> <OPTION VALUE="Niue">Niue</OPTION> <OPTION VALUE="Norfolk Island">Norfolk Island</OPTION> <OPTION VALUE="Northern Mariana Is.">Northern Mariana Is.</OPTION> <OPTION VALUE="Norway">Norway</OPTION> <OPTION VALUE="Oman">Oman</OPTION> <OPTION VALUE="Pakistan">Pakistan</OPTION> <OPTION VALUE="Palau">Palau</OPTION> <OPTION VALUE="Panama">Panama</OPTION> <OPTION VALUE="Papua New Guinea">Papua New Guinea</OPTION> <OPTION VALUE="Paraguay">Paraguay</OPTION> <OPTION VALUE="Peru">Peru</OPTION> <OPTION VALUE="Philippines">Philippines</OPTION> <OPTION VALUE="Pitcairn">Pitcairn</OPTION> <OPTION VALUE="Poland">Poland</OPTION> <OPTION VALUE="Portugal">Portugal</OPTION> <OPTION VALUE="Puerto Rico">Puerto Rico</OPTION> <OPTION VALUE="Qatar">Qatar</OPTION> <OPTION VALUE="Reunion">Reunion</OPTION> <OPTION VALUE="Romania">Romania</OPTION> <OPTION VALUE="Russian Federation">Russian Federation</OPTION> <OPTION VALUE="Rwanda">Rwanda</OPTION> <OPTION VALUE="Saint Kitts and Nevis">Saint Kitts and Nevis</OPTION> <OPTION VALUE="Saint Lucia">Saint Lucia</OPTION> <OPTION VALUE="Samoa">Samoa</OPTION> <OPTION VALUE="San Marino">San Marino</OPTION> <OPTION VALUE="Sao Tome & Principe">Sao Tome & Principe</OPTION> <OPTION VALUE="Saudi Arabia">Saudi Arabia</OPTION> <OPTION VALUE="Senegal">Senegal</OPTION> <OPTION VALUE="Seychelles">Seychelles</OPTION> <OPTION VALUE="Sierra Leone">Sierra Leone</OPTION> <OPTION VALUE="Singapore">Singapore</OPTION> <OPTION VALUE="Slovakia">Slovakia </OPTION> <OPTION VALUE="Slovenia">Slovenia</OPTION> <OPTION VALUE="Solomon Islands">Solomon Islands</OPTION> <OPTION VALUE="Somalia">Somalia</OPTION> <OPTION VALUE="South Africa">South Africa</OPTION> <OPTION VALUE="Spain">Spain</OPTION> <OPTION VALUE="Sri Lanka">Sri Lanka</OPTION> <OPTION VALUE="St. Helena">St. Helena</OPTION> <OPTION VALUE="Sudan">Sudan</OPTION> <OPTION VALUE="Suriname">Suriname</OPTION> <OPTION VALUE="Swaziland">Swaziland</OPTION> <OPTION VALUE="Sweden">Sweden</OPTION> <OPTION VALUE="Switzerland">Switzerland</OPTION> <OPTION VALUE="Syrian Arab Republic">Syrian Arab Republic</OPTION> <OPTION VALUE="Taiwan">Taiwan</OPTION> <OPTION VALUE="Tajikistan">Tajikistan</OPTION> <OPTION VALUE="Tanzania">Tanzania</OPTION> <OPTION VALUE="Thailand">Thailand</OPTION> <OPTION VALUE="Togo">Togo</OPTION> <OPTION VALUE="Tokelau">Tokelau</OPTION> <OPTION VALUE="Tonga">Tonga</OPTION> <OPTION VALUE="Trinidad and Tobago">Trinidad and Tobago</OPTION> <OPTION VALUE="Tunisia">Tunisia</OPTION> <OPTION VALUE="Turkey">Turkey</OPTION> <OPTION VALUE="Turkmenistan">Turkmenistan</OPTION> <OPTION VALUE="Tuvalu">Tuvalu</OPTION> <OPTION VALUE="Uganda">Uganda</OPTION> <OPTION VALUE="Ukraine">Ukraine</OPTION> <OPTION VALUE="United Arab Emirates">United Arab Emirates</OPTION> <OPTION VALUE="United Kingdom">United Kingdom</OPTION> <OPTION VALUE="U.S. Minor Outlying Is.">U.S. Minor Outlying Is.</OPTION> <OPTION VALUE="Uruguay">Uruguay</OPTION> <OPTION VALUE="Uzbekistan">Uzbekistan</OPTION> <OPTION VALUE="Vanuatu">Vanuatu</OPTION> <OPTION VALUE="Vatican">Vatican</OPTION> <OPTION VALUE="Venezuela">Venezuela</OPTION> <OPTION VALUE="Viet Nam">Viet Nam</OPTION> <OPTION VALUE="Virgin Islands (British)">Virgin Islands (British)</OPTION> <OPTION VALUE="Virgin Islands (U.S.)">Virgin Islands (U.S.)</OPTION> <OPTION VALUE="Western Sahara">Western Sahara</OPTION> <OPTION VALUE="Yemen">Yemen</OPTION> <OPTION VALUE="Yugoslavia">Yugoslavia</OPTION> <OPTION VALUE="Zaire">Zaire</OPTION> <OPTION VALUE="Zambia">Zambia</OPTION> <OPTION VALUE="Zimbabwe">Zimbabwe</OPTION> </SELECT> Sorry for the excessively long posts =\ It doesn't appear to be any spaces, however. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882840 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 Whoa wait a second... I restarted firefox and its working.. not sure when it started, b/c I was just using F5 to refresh the page. Well its working lol Thanks for all the help guys, I appr it. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882844 Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 Was gonna say... in a text file to db a \n is on the end of the line. But trim should have taken care of that. Was gonna next suggest changing selected='selected' instead of SELECTED (something you should do anyways) Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882845 Share on other sites More sharing options...
imperialized Posted July 25, 2009 Author Share Posted July 25, 2009 I'll make that change now Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882847 Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 yeah you should also go ahead and either manually or write a quick script to trim your db entries to get rid of the \n's so you don't have to have those trims in there. data in dbs should be as unformatted as possible. Quote Link to comment https://forums.phpfreaks.com/topic/167422-string-comparison/#findComment-882852 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.