Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-02-2007, 11:54 PM   PM User | #1
mochden
New Coder

 
Join Date: Nov 2007
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
mochden is an unknown quantity at this point
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
mochden is offline   Reply With Quote
Old 11-03-2007, 12:16 AM   PM User | #2
toddandrae
New Coder

 
Join Date: Oct 2007
Posts: 84
Thanks: 0
Thanked 8 Times in 8 Posts
toddandrae is an unknown quantity at this point
SELECT * FROM table WHERE catid = 'whatever'
toddandrae is offline   Reply With Quote
Old 11-03-2007, 12:23 AM   PM User | #3
mochden
New Coder

 
Join Date: Nov 2007
Posts: 14
Thanks: 1
Thanked 0 Times in 0 Posts
mochden is an unknown quantity at this point
awesome, thanks a lot for the help.
mochden is offline   Reply With Quote
Old 11-03-2007, 12:31 AM   PM User | #4
toddandrae
New Coder

 
Join Date: Oct 2007
Posts: 84
Thanks: 0
Thanked 8 Times in 8 Posts
toddandrae is an unknown quantity at this point
I would recommend on reading up on MySQL LIMIT since that is where I see this heading
toddandrae is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:50 AM.


Advertisement
Log in to turn off these ads.