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

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.