Forums

PHP

This topic is locked

Select Specific Rows

Posted 05 Apr 2005 11:53:16
1
has voted
05 Apr 2005 11:53:16 Matt Bailey posted:
I'm trying to display specific rows from my database. I've played around with my code for a while, but just can't seem to get it working. Here's an example of what I've tried:

do { echo $row_ClientsRS['ClientName']; } while ($row_ClientsRS['CategoryID'] = 1);

The clients are all put in Categories and associated using 'CategoryID'. I just want to be able to change what the CategoryID is in my php code to display the specific category I want.

___________________________________
* Sorry... how do you do that again?... *

Replies

Replied 05 Apr 2005 12:39:58
05 Apr 2005 12:39:58 Dave Thomas replied:
ive been using php for like a week, but shouldn't this go in a variable as a query?

forgive the syntax, but maybe something like this

<pre id=code><font face=courier size=2 id=code>
$categories = mysql_query("SELECT * FROM yourtable WHERE CategoryID = 1";

for($j = 0; $j &lt; mysql_num_rows($categories); $j++)
{
$category = mysql_fetch_array($categories);

echo ......
}
</font id=code></pre id=code>

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 05 Apr 2005 15:25:43
05 Apr 2005 15:25:43 Matt Bailey replied:
Ah yes, that makes sense. I'll give it a go. Thanks <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

___________________________________
* Sorry... how do you do that again?... *
Replied 30 Apr 2005 04:11:39
30 Apr 2005 04:11:39 Dave Thomas replied:
now that ive just read that post again my answer was soooo wrong :/

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 30 Apr 2005 19:08:35
30 Apr 2005 19:08:35 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>now that ive just read that post again my answer was soooo wrong :/ ....Dave Thomas<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Fix it! <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Replied 30 Apr 2005 20:15:13
30 Apr 2005 20:15:13 Matt Bailey replied:
Not quite sure, but I think I worked it out. Thanks all the same though <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

___________________________________
* Sorry... how do you do that again?... *

Reply to this topic