...

View Full Version : Outputting data from a mySQL table



mochden
11-02-2007, 11:54 PM
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.



<? 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

toddandrae
11-03-2007, 12:16 AM
SELECT * FROM table WHERE catid = 'whatever'

mochden
11-03-2007, 12:23 AM
awesome, thanks a lot for the help.

toddandrae
11-03-2007, 12:31 AM
I would recommend on reading up on MySQL LIMIT since that is where I see this heading :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum