php - Link only visible for certain users? -



how make hyperlink product table visible session user subscribed in user table while non-subscribed user can not see link product table?

this current code have.

<?php $db = mysql_connect("localhost", "", ""); mysql_select_db("",$db); $result = mysql_query("select * inventorytable",$db); $query="select * users sub = 'yes'"; $id=mysql_query($query); echo "<table style=\"background-color: #ffffff; border: 10px solid a4a4a4;\">"; echo"<tr><td><b>title</b> <td><b>authors first name</b> <td><b>authors last name</b> <td><b>isbn</b><td> <b>publisher</b> <td><b>course number</b> <td><b>source</b></tr>"; while ($myrow = mysql_fetch_array($result)) { echo "<tr><td>".$myrow["title"]. "<td>".$myrow["authorsfirst"]. "<td>".$myrow["authorslast"]. "<td>".$myrow["isbn"]. "<td>".$myrow["publisher"]. "<td>".$myrow["coursenum"]; if($_session['username']== '$id') {"<td>".$myrow["source"]; } else {     echo "<td>"."please subscribe view"; } echo "</table>";  } ?> 

my if statement returning false. wanting users user table have 'yes' in sub field able view source field inventorytable.

if($_session[username]== subscribed id or name){ $myrow["link"]}else{blank } 

Comments