PHP MySQL how to associate two fields in one table row? -


If I could talk to your database tables do, I say "if client_id and salesrep_id are in the same line, so

Most of the conditional logic has been found. I am struggling with this "in the same line" part.

Basically, I was creating a system I am a sales representative who allows everyone to view the entire data table, but only to each representative

This idea is to disable someone else's "edit" link in the display.

Like ... < pre> & lt ;? Php if ($ row_listClients [ 'client_id'] & amp; $ row_list elected [ 'salesrep_id']) {? & Gt; & lt; td & gt; & lt; A href = "Edit_clients.php? Client_id = & lt ;? Php echo $ row_listClients ['client_id']; ? & Gt; "& Gt; Edit

Obviously, the initial state does not work (and it will always be true), but everything else works great. It's just a bit that I'm stuck on I hope it is understood, I know that this is probably the most basic stuff.

Thanks a bunch, any signal will be really appreciated .

-

here's the query:

  $ query_listClients = "Choose client_id, user_id, repname, date, client_type, company, contact_firstname, con tact_lastname, phone, email, property, address, city, province, repnotes FROM clientdata ORDER "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 have just entered as a test. The first two numbers are respectively client_id and user_id:

  19 "33"; "Ronald Wharton"; "20 March 2013"; "Professional"; "Bockers Inc."; "Brett"; "Bonkers"; "987 654 3211"; "Brentbonkers@bonkersinc.com"; "Retail Outlet"; "12765 34 Avenue"; "Lost Soul City"; "Sask"; "Brett wants to meet Keith and Dean before the end of the week. Please call on Friday."   

I do not know if this is any help, but still, thank you.

I have been questioned to obtain as you record your question, I read again it seems , But only want to show an edit link for the item, there should be permission to edit a particular sales representative.

Since you want to record, so it should not be done through SQL, and it seems to do something that you do, it changes:

 < Code> & lt ;? Php if ($ row_listClients ['client_id'] & $ row_list selected ['salesrep_id']) {? & Gt;   

To do something like this:

  & lt ;? Php if ($ row_listClients ['salesrep_id'] == $ Current SalesRepId) {? & Gt;   

You will obviously need to use the appropriate variable for $ currentSalesRepId .

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -