1 Reply Latest reply on Dec 11, 2008 4:57 PM by (Purple_Edge)

    problem adding a filter to Recordset

      Hi,

      I have added a record set to a page, and it works fine.

      Then I add a filter to the record set so I can work with the record stipulated by the URL parameter, and it stops working.

      Here is the code that is added without a filter:

      mysql_select_db($database_ecards_01, $ecards_01);
      $query_currContent = "SELECT * FROM `7417_content`";
      $currContent = mysql_query($query_currContent, $ecards_01) or die(mysql_error());
      $row_currContent = mysql_fetch_assoc($currContent);
      $totalRows_currContent = mysql_num_rows($currContent);

      Here is what is added for the filter:

      $colname_currContent = "-1";
      if (isset($_GET['ID_cnt'])) {
      $colname_currContent = $_GET['ID_cnt'];
      }
      mysql_select_db($database_ecards_01, $ecards_01);
      $query_currContent = sprintf("SELECT * FROM `7417_content` WHERE ID_cnt = %s", GetSQLValueString($colname_currContent, "int"));
      $currContent = mysql_query($query_currContent, $ecards_01) or die(mysql_error());
      $row_currContent = mysql_fetch_assoc($currContent);
      $totalRows_currContent = mysql_num_rows($currContent);

      And there is also the usual 'mysql_free_result($currContent);' line added at the bottom of the page.

      It seems to all fall over on this line:
      $query_currContent = sprintf("SELECT * FROM `7417_content` WHERE ID_cnt = %s", GetSQLValueString($colname_currContent, "int"));

      as I have narrowed this down by commenting lines out step by step.

      I should also mention that the recrod set works fine on my local machine (using the TEST button in the dialog box that sets all parameters).

      Is this something anyone else has experienced as well?
      How can I fix this?
      Do you need to know anything else?

      Thanks,

      Nik