Page 1 of 1

Help please:)

Posted: Sat Dec 21, 2002 7:20 pm
by hawkeye177
I need help writing a script that will get the all the stuff that are in two fields and order them by the number. Is there a way i can do it?

Here's my format.
hawkshar_doc is my DB Name
user Table
email field
dp field
team field

I would like for the script to show the email and the dp field only, and order by number in the dp field .

Also i got another thing...
Is there a way i can have another site where it only shows the people who have like team number 1 in the team field?

Thank in advance!

Posted: Sat Dec 21, 2002 7:37 pm
by evilcoder
What are "dp"'s attributes? eg: is it like an ID field that is set to AUTO_INCREMENT?

Posted: Sat Dec 21, 2002 7:47 pm
by evilcoder
Never mind my last post, just do this:

Connect to the database as normal, then where you want the fields to be shown in the document add this:

<table width="100%">
<?php

$userlist = mysql_query("SELECT email, team FROM user ORDER BY dp DESC");

while ($list= mysql_fetch_array($userlist)) {
$email= $product["email"];
$team= $product["team"];
$dp= $product["dp"];
?>
<tr>
<td>
<?=$email?>
</td>
</tr>
<tr>
<td >
<?=$dp ?>
</td>
</tr>
<?php
}

?>
</table>