0
Welcome Guest! Login
0 items Join Now

What's wrong with my PHP code ?

    • Arnaud's Avatar
    • Arnaud
    • Sr. Rocketeer
    • Posts: 102
    • Thanks: 0

    What's wrong with my PHP code ?

    Posted 17 years 3 weeks ago
    • Hi everybody !

      I have a problem with a module i'm trying to develop. I can't find what's wrong with my code, so your help would be very appreciate !

      I pass a variable in my url to filter on my news categories. Here is my URL with my variable 'cat' :
      index.php?option=com_content&task=section&id=1&Itemid=2&cat=13

      Now, here is my PHP code to extract my variable content :
      $url = $_SERVER['QUERY_STRING'];
      parse_str($url, $output);
      $cat = $output['cat'];

      And now my SQL code :
      $query = "SELECT count(id) FROM #__content WHERE sectionid = '1' AND catid = $cat AND state = '1'";

      When i execute my module, i have no result. If i set the debug mode on, i can see my variable is passed :
      SELECT count(id) FROM jos_content WHERE sectionid = '1' AND catid = 13 AND state = '1'

      But, if i manually set "$cat = 13" in my php code, i have my module result !

      I don't know why it's not working... Someone could help me, please ?
    • Arnaud's Avatar
    • Arnaud
    • Sr. Rocketeer
    • Posts: 102
    • Thanks: 0

    Re: What's wrong with my PHP code ?

    Posted 17 years 3 weeks ago
    • I've found the problem.

      Sorry !
  • Re: What's wrong with my PHP code ?

    Posted 17 years 3 weeks ago
    • So what was it? Inquiring minds want to know.

Time to create page: 0.060 seconds