dflow Posted January 5, 2010 Share Posted January 5, 2010 this works on my localhost when i uploaded it, it's just wont get the query result echoed same databse fields query works on phpmyadmin then on the webserver i get also this error although the query is correct Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in findState2.php on line 52 your help <?php require_once('../Connections/international.php'); ?> <?php $CatID=intval($_GET['CatID']); ?> <?php mysql_query("SET NAMES 'utf8'")?> <?php if (isset($CatID)) { } switch ($CatID) { case 0: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CategoryID = '".$_GET['CatID']."'"); break; case 1: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CategoryID = '".$_GET['CatID']."'"); break; case 2: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID2 = '".$_GET['CatID']."'"); break; case 3: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID3 = '".$_GET['CatID']."'"); break; case 4: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID4 = '".$_GET['CatID']."'"); break; case 5: $result = mysql_query("SELECT country_list.CountryID,country_list.CountryName,country_list.CountryName_heb from country_list WHERE CatID5 = '".$_GET['CatID']."'"); break; } ?> <select name="state" onchange="getCity(<?php echo $CatID;?>,this.value)"> <option>Select Country</option> <?php while($row_result=mysql_fetch_assoc($result)) { ?> <option value="<?php echo $row_result['CountryID']; ?>"><?php echo $row_result['CountryName']; ?></option> <?php } ?> </select> <?php mysql_free_result($result); ?> Quote Link to comment https://forums.phpfreaks.com/topic/187267-stuck-select-box-not-getting-list-from-query/ Share on other sites More sharing options...
taquitosensei Posted January 5, 2010 Share Posted January 5, 2010 do this print_r($result); die(); after your switch for the CatID the should tell you what the error is. Quote Link to comment https://forums.phpfreaks.com/topic/187267-stuck-select-box-not-getting-list-from-query/#findComment-988983 Share on other sites More sharing options...
dflow Posted January 6, 2010 Author Share Posted January 6, 2010 i do this print_r($result); die(); after your switch for the CatID the should tell you what the error is. i get no error nada the loop isn t populating the the select box Quote Link to comment https://forums.phpfreaks.com/topic/187267-stuck-select-box-not-getting-list-from-query/#findComment-989648 Share on other sites More sharing options...
dflow Posted January 6, 2010 Author Share Posted January 6, 2010 ok i solved this but now i am missing the first row from my query result i dont get number 1 Quote Link to comment https://forums.phpfreaks.com/topic/187267-stuck-select-box-not-getting-list-from-query/#findComment-989678 Share on other sites More sharing options...
dflow Posted January 6, 2010 Author Share Posted January 6, 2010 duplicate case of mysql_fetch_assoc Quote Link to comment https://forums.phpfreaks.com/topic/187267-stuck-select-box-not-getting-list-from-query/#findComment-989689 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.