Forum Moderators: coopster

Message Too Old, No Replies

Requesting a specific id

         

goody2

11:50 pm on Jul 28, 2011 (gmt 0)

10+ Year Member



First of all thanks to "httpwebwitch" for helping me with my last issue.

My next issue is im trying to pull data from a specific id. CODE BELOW...


<?php
include 'connect.php';
?><?php

$teamid = $_GET["id"];
if (!is_numeric($teamid)){die();}


$query = "SELECT * FROM payrollandcap11";
$result = mysql_query($query);
$num = mysql_num_rows ($result);
mysql_close();

if ($num > 0 ) {
$i=0;
while ($i < $num) {
$Roster_Size = mysql_result($result,$i,"Roster_Size");
$salary_cap = mysql_result($result,$i,"salary_cap");
$payroll = mysql_result($result,$i,"payroll");
$deductions = mysql_result($result,$i,"deductions");
$cap_space = mysql_result($result,$i,"cap_space");
$id = mysql_result($result,$i,"id");

echo "<b>Roster Size:</b> $Roster_Size<br>";
echo "<b>Salary Cap:</b> $salary_cap<br>";
echo "<b>Payroll:</b> $payroll<br>";
echo "<b><u>Deductions:</u></b> <u>$deductions</u><br>";
echo "<b>Cap Space:</b> $cap_space<br>";
echo "<br><br>";

++$i; } } else { echo "The database is empty"; }?></div>
</td>
</tr>
</table>
</div>

<!-- END TEAM PAYROLL SUMMARY -->



Ive pulled the right info but ive pulled it from all of the teams i have and am just looking for that info from a certain id..

Really having fits with this "select" query but grabbing it one issue at a time... Sorry for my ignorance gents but being disabled i have alot of time and am mostly self taught.

Thanks in advance to everyone....

astupidname

6:22 am on Jul 29, 2011 (gmt 0)

10+ Year Member



Try:
$query = "SELECT * FROM payrollandcap11 WHERE id=$teamid";

goody2

3:09 pm on Jul 29, 2011 (gmt 0)

10+ Year Member



Thank you "astupidname".. That did the trick.... Another lesson learned..