View Single Post
Old 09-03-2012, 10:49 PM   PM User | #1
jake66
New Coder

 
Join Date: Jul 2011
Posts: 23
Thanks: 8
Thanked 0 Times in 0 Posts
jake66 is an unknown quantity at this point
using data from mysql_fetch_array

Hi,
I have taken data from MySQL in the standard way and have $row['datefield'] etc to use in a table. Depending on a specific column value, some of the records are editable and so an edit link should be shown only next to those records in a separate column. I don't really understand how I can make this happen.
Here's my code
Code:
while($rows=mysql_fetch_array($result)){
	$rows['date'] = date( "d/m/Y", $rows['date_ts'] );
?>
<tr>
<td nowrap><? echo $rows['datefield']; ?></td>
<td nowrap><? echo $rows['shift']; ?></td>
<td nowrap> <? echo $rows['reason'];?></td>
<td nowrap> <? echo $rows['person_covering']; ?></td>
<td nowrap> &pound;<? echo $rows['cost']; ?></td>
<td nowrap> <? 	if(  substr( trim( $rows['staff_approved'] ), 0, 3)  === "Yes"){ }
else { ?> <a href="updaterecord.php?id=<? echo $rows['id'];?>">Edit<? }?>
I am checking whether the staff approved column starts with Yes and if it does not then showing an edit link. However this seems to show edit links for all of them....

Any help gratefully welcomed,
Jake

Last edited by jake66; 09-05-2012 at 08:45 PM.. Reason: resolved
jake66 is offline   Reply With Quote