Reputation: 37233
i have this code
$sql3 = mysql_query (" ") ;
while($row3 =mysql_fetch_array($sql3)) {
$sql4 = mysql_query (" SELECT $ww as yourplace FROM data WHERE $ww =
".$row3[$ww]." and id_user = ".$userid." ");
$row4 = mysql_fetch_array($sql4) ;
$string = "<< You Here" ;
echo "<tr><td width='100'>Week ".$row3[$ww]."</td>" ;
echo "<td width='300' >".(int) $row3["percent"] ."%</td>";
echo "<td width='300' > "?><?php echo $row4['yourplace'] ;?><?php "</td></tr>";
}
how to replace $row4['yourplace']
in line 10 by the $string
in line 6 .
now $row4['yourplace']
appears only in specific line in table , so when i use this code
$row4['yourplace'] = $string ;
this will replace but will appear in all lines in the table. so i want to be replaced and appears in the specified lines also .
Upvotes: 2
Views: 158
Reputation: 1583
I am still not sure about your if condition but you would probably like to do something like this,
echo "<td width='300' > "?><?php if($sql4) echo $string else $row4['yourplace'] ;?><?php "</td></tr>";
You can replace $sql4 with whatever condition your code has.
UPDATE:
Here's what you can do,
if($row4[$ww] == $row3[$ww] && $row4['id_user'] == $userid )
echo $string ;
else
echo "";
Upvotes: 1