If I could talk to my database table, I would say "if client_id and salesrep_id are in the same row, do this!
Most of the conditional logic I've got. It's the "in the same row" part I'm struggling with.
Essentially, I'm building a system that allows all sales reps to view the entire data table but will permit each rep to update only their own specific entries.
The idea is to disable everybody else's "EDIT" links in the display.
Like so ...
<?php if ($row_listClients['client_id'] && $row_listClients['salesrep_id']) { ?>
<td><a href="edit_clients.php?client_id=<?php echo $row_listClients['client_id']; ?>">Edit</a>
</td>
<?php } else { ?>
<td>Edit</td>
<?php } ?>
Obviously the initial condition doesn't work ( && will always be true ) but everything else works great. It's just this one bit I'm stuck on.
Hope that makes sense, I know it's probably pretty basic stuff.
Thanks a bunch guys, any pointers would be really appreciated.
--
Here's the query :
$query_listClients = "SELECT client_id, user_id, repname, date, client_type, company,
contact_firstname, contact_lastname, phone, email, property, address, city, province,
repnotes FROM clientdata ORDER BY company ASC";
$listClients = mysql_query($query_listClients, $connAdmin) or die(mysql_error());
$row_listClients = mysql_fetch_assoc($listClients);
Thanks again ...
--
Sample of database data - which I entered as a test only. The first two number are client_id and user_id respectively:
19;"33"; "Ronald Wharton"; "March 20 2013"; "Commercial"; "Bonkers Inc."; "Brett";
"Bonkers"; "987 654 3211"; "brentbonkers@bonkersinc.com"; "Retail Outlet";
"12765 34 Ave"; "Lost Soul City"; "Sask"; "Brett wants to meet with Keith and Dean
before the end of the week. Please call before Friday."
Don't know if that's any help, but there ya go, thanks.