PDA

View Full Version : How to get the changing id value


sirtom
08-30-2004, 10:31 PM
This part of code works as I need, I get the tasks listed by names
<?
$sql = "select task.id as t_id,task.name as t_name".
"from ties,task where ties.what=task.id and ties.type='2' order by task.name";
$res = $A->Q($sql,"");
while($row = $A->fetch($res)){
echo "<INPUT ";
if (!$con || $con[$row["t_id"]]) echo "checked ";
echo "TYPE=\"checkbox\" NAME=\"con[".$row["t_id"]."]\">".$row["t_name"] .$row["t_id"];
?>

The next part of code works as well only missing one variable in query the task id value thats in first query .$row["t_id"].
Well I hope I explained it in undestandable way.
Once again I am getting list of tasks (eachone with is id number)
Behind each task I want to show to how many people it belongs. Everything is set up correctly but I dont know how to add into query the changing id value where dots are right now ..........
<?
$recsql = "SELECT count(*) as rec FROM ties t, uk u where u.type_id=$group_id AND t.what = u.id AND t.type = 3 AND t.who =...................";
$recq = mysql_query ($recsql);
$rec_res = mysql_fetch_array ($recq);
$assigned = $rec_res[rec];
?>
<?
if ( $assigned ==0 ) {
echo ("")
?>
<?
} else if ( $assigned == 1 ){
?>
<img src="img/count1.gif" width="200" height="10">(<?=$assigned?>)
<?
} else if ( $assigned == 2 ){
?>
<img src="img/count2.gif" width="200" height="10">(<?=$assigned?>)
<?
}
?>