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 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2007
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Outputting data from a mySQL table

    hi there, im looking for help on how to get data out from a table, i did that part well, but now what i need is getting some of that info out not all, this table is where i store all the videos i add to our website, we put the videos into defferent categories, which is an other table in sql, so in this table that im pulling out the videos have a "catid" number from which category they belong. i need to pull out only the catid *44*#, and so far this is the code i have which pulls out all items in this table.

    Code:
    <? include("dbinfo.inc.php");
    mysql_connect(localhost,$username,$password);
    @mysql_select_db($database) or die( "Unable to select database");
    $query="SELECT * FROM jos_seyret_items";
    $result=mysql_query($query);
    
    $num=mysql_numrows($result); 
    
    mysql_close();
    
    echo "<b><center>What's Hot</center></b><br><br>";
    
    $i=0;
    while ($i < $num) {
    
    $id=mysql_result($result,$i,"id");
    $title=mysql_result($result,$i,"title");
    $itemcomment=mysql_result($result,$i,"itemcomment");
    $picturelink=mysql_result($result,$i,"picturelink");
    
    echo "<table border=0 cellpadding=5><tr><td><a href=http://www.webcastr.com/index.php?option=com_seyret&Itemid=27&task=videodirectlink&id=$id><img src=$picturelink border=0 width=80 height=65></a></td><td valign=top><font face=arial size=2><b><a href=http://www.webcastr.com/index.php?option=com_seyret&Itemid=27&task=videodirectlink&id=$id>$title</a></b></font><br><font face=arial size=0>$itemcomment</font></td></tr></table>";
    
    $i++;
    }
    
    ?>
    any help will be awesome thx :P

  • #2
    New Coder
    Join Date
    Oct 2007
    Posts
    84
    Thanks
    0
    Thanked 8 Times in 8 Posts
    SELECT * FROM table WHERE catid = 'whatever'

  • #3
    New Coder
    Join Date
    Nov 2007
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    awesome, thanks a lot for the help.

  • #4
    New Coder
    Join Date
    Oct 2007
    Posts
    84
    Thanks
    0
    Thanked 8 Times in 8 Posts
    I would recommend on reading up on MySQL LIMIT since that is where I see this heading


  •  

    Posting Permissions

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