Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL Fetch not showing results.

    Hello!

    I'm fairly new to PHP coding, and also all other forms of coding too...

    I run a website that someone else does the "big boy jobs" on, while I have to somehow figure out the little ones.

    I am trying to fetch new results from the SQL.

    This one worked in the old version- $q_videos = "SELECT * FROM `videos`,`users` WHERE (`videos`.uid = `users`.uid AND `catagory` LIKE '$cat')" or die( "Unable to select database");

    But I am trying to add an "active = 1" as we have active, and inactive videos now.

    The active part is kept in the Videos section in the SQL also, so I assumed this would work;
    $q_videos = "SELECT * FROM `videos`,`users` WHERE (`videos`.uid = `users`.uid AND `catagory` LIKE '$cat' AND `active` = '1')" or die( "Unable to select database");

    I probably did something so tiny wrong, but I'm a newb who needs sympathy.

    Any help would be super lovely!

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    I suppose

    `active` = 1
    instead of
    `active` = '1'

    might help

    If there are such data (Type int, value 1) in 'active' column of table 'videos'

    Otherviuse you simply don't have '1' data in 'active' column of Type varchar or similar
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    You also don't say what error you get, if any.

    And did you try the query from a query tool, *NOT* from your own PHP code?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •