Jump to content

stuck- select box not getting list from query


dflow

Recommended Posts

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 :wtf::confused:

<?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);
?>

Archived

This topic is now archived and is closed to further replies.

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