trouble with Select.

Im trying to pull and show the info below. THe select line is what im having trouble with.

[php]<?php
// Connects to your Database
$teamid = $_GET[“id”];
if (!is_numeric($teamid)){die();}

$sql = "select * from playerslist11, teams.teamnameseason AND teams.Team = (SELECT Team from teams WHERE newsid = " . $teamid . “) ORDER BY season11.P DESC”;

$data = mysql_query($sql)
or die(mysql_error());

Print “

”;
Print “”;
Print “”;
Print “”;
Print “”;
Print “”;
Print “”;
Print “”;
Print "";
Print “”;
Print “”;
Print “”;
Print “”;

while($info = mysql_fetch_array( $data ))
{
$wins = $info[‘W’];
$OTW = $info[‘OW’];
$totalwins = $wins + $OTW ;

$teamnameseason = $info[‘teamnameseason’];
Print “

”;
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";
Print “ ";

}

Print “

TEAM#NAMEPOSSALARYCONTRACTSTATUS11/12 SALARY 12/13 SALARY13/14 SALARYPROTECTEDROOKIE
”.$info[‘Team’] . "”.$info[‘Num’] . "”;
Print $totalwins;
Print "
”.$info[‘Name’] . "”.$info[‘Pos’] . "”.$info[‘Salary’] . "”.$info[‘Contract’] . "”.$info[‘11/12_Salary’] . "”.$info[‘12/13_Salary’] . "”.$info[‘13/14_Salary’] . "”.$info[‘Protected’] . "”.$info[‘Rookie’] . "
”;
?> <?php include 'closedb.php'; ?>[/php]

any help would be fantastic…

IN "select * from playerslist11, teams.teamnameseason AND teams.Team = (SELECT Team from teams WHERE newsid = " . $teamid . “) ORDER BY season11.P DESC”;

There is no where clause after selecing table if you want to run such type of query you have to use it like this.

select * from table_name where table_name.field =(select field from table_name2 where field_id = “Field_Reg_id”) ORDER BY table_name2 DESC

Hope you understand you mistake

Yes. That helps alot. Thanks man… :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service