Results 1 to 3 of 3

Thread: MySQL php WHERE?

  1. #1
    Join Date
    May 2006
    Posts
    266
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default MySQL php WHERE?

    Hi i am trying to do a WHERE function but cant seem to get it working this time.
    I am trying to get only News items from the row named type

    [code]
    <?php

    $mainplayer = "SELECT * FROM jos_video WHERE type = news LIMIT 1";
    $mainplayerresult = mysql_query($mainplayer);
    while($row = mysql_fetch_assoc($mainplayerresult))
    {
    echo "http://www.queerhuntradio.com/images/video/{$row['url']}";
    }
    ?>
    The web in one word.

  2. #2
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    Try using:

    PHP Code:
    WHERE type 'news' LIMIT 1 
    Sometimes solves the problem.

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Better to tick your table names and fields to:
    PHP Code:
    $mainplayer "SELECT * FROM `jos_video` WHERE `type` = 'news' LIMIT 1"
    And return errors too:
    PHP Code:
    $mainplayerresult mysql_query($mainplayer) or die("Mysql Error: ".mysql_error()); 
    Jeremy | jfein.net

Bookmarks

Posting Permissions

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