1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Making a RSS feed - Query Error

Discussion in 'Databases' started by DogFaceBoy, Oct 12, 2006.

  1. #1
    I have this code:

    
    <?php
    $db_host = "localhost";
    $db_user = "blank";
    $db_password = "blank";
    $db_name = "blank";
     
    
    // parametri del database
    $db = mysql_connect($db_host, $db_user, $db_password);
    mysql_select_db($db_name, $db)
    or die ("Errore nella selezione del database.");
    
     header('Content-type: text/xml'); ?>
    
    <rss version="2.0">
    <channel>
    <title>CurrentHumor.com</title>
    <description>Funny Videos and Sexy Videos</description>
    <link>http://www.currenthumor.com/</link>
    
    
    <?
    $query="SELECT * FROM content WHERE content.id AND content.thumb ORDER BY added DESC LIMIT 0,15 ";
    $result = mysql_query($query); 
    
    while($row = mysql_fetch_array($result))
    
    {
    echo 
         "	<item> 
            <title>".$row['title']."</title> 
            <link>http://www.currenthumor.com/index.php?out=".$row['id']."</link> 
    	<image>http://www.currenthumor.com/thumbs/".$row['thumb']."</image>
    </item>";
     }  
    ?>
    </channel>
    </rss>
    
    PHP:
    I get this error here: http://www.currenthumor.com/rss.php


    I am a complete beginner to this, so help me out and explain well.

    Thanks.

    Regards,
    Kyle
     
    DogFaceBoy, Oct 12, 2006 IP
  2. rb3m

    rb3m Peon

    Messages:
    192
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think your query is coming up empty. Check that $result is not empty before the while loop.
     
    rb3m, Oct 12, 2006 IP
    DogFaceBoy likes this.
  3. DogFaceBoy

    DogFaceBoy Peon

    Messages:
    946
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, your input lead me to finding the problem.

    Later,
    Kyle
     
    DogFaceBoy, Oct 12, 2006 IP
  4. Blanket

    Blanket Peon

    Messages:
    409
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    cool. nice tip
     
    Blanket, Oct 21, 2006 IP