This topic is locked
[SOLVED]

 Show member who inserted record

8/1/2020 10:03:43 AM
PHPRunner General questions
A
alghanim author

How to show the member who entered the record in the watch list
thanks for the help

HJB 8/1/2020

Assuming, you want to ADD the user name in the LIST page, you can make use

of the following to be placed in the event Before record added:

$rs = CustomQuery("SELECT FullName FROM Users WHERE UserID=".$value."");

$record = db_fetch_array($rs);
$value = $record['FullName'];


P.S. Making the field FullName to be a hidden one (READ-ONLY) is mandatory.

A
alghanim author 8/1/2020

Where do I paste the code into the add page or in the display page?

HJB 8/1/2020

https://xlinesoft.com/phprunner/docs/before_record_added.htm
quote excerpt out of URL content above:
It works in all add modes: Inline Add, Regular Add and an Add page in popup.
P.S. Switch to the EVENTS menue inside PHPRUNNER, then click on that very TABLE you

want to see the event oriented code above to work. Under that TABLE you shall then

find the ADD page (below LIST page), click on that to open the tree menue, then go

the point Before Record Added under ADD page and place the code there.
Make sure to adjust the code according to your design (say, to correct ... FullName

from USERS ...) to your table and field naming you have.
After placement of the code, make good use of the CHECK SYNTAX feature from the upper

menue (a green hook symbol) and if showing OKAY, then re-generate your project then.

A
alghanim author 8/1/2020

Thanks for your response

But I did not understand the location of the file that I put the code in and put it in the display file and also in the extension file the wrong message.

HJB 8/1/2020



Thanks for your response

But I did not understand the location of the file that I put the code in and put it in the display file and also in the extension file the wrong message.


Below you can see how the EVENTS section displays a TREE MENUE, so, click on that very TABLE NAME you want to see the code to work, NEXT, under that

TABLE NAME (after click on that) you see ADD PAGE as a sub-tree menue point, CLICK on that to be able to then view "BEFORE RECORD ADDED",

click on that BEFORE RECORD ADDED menue point to view the page where you then can place the code.

A
alghanim author 8/1/2020

Thank you again <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=92163&image=1&table=forumreplies' class='bbc_emoticon' alt=':wub:' />

I added the code

But how do I display the name in the list or view

HJB 8/1/2020



Thank you again <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=92164&image=1&table=forumreplies' class='bbc_emoticon' alt=':wub:' />

I added the code

But how do I display the name in the list or view


You need to ADD a field named for example Entered by USER (or else you think to suit the

needs ...) to the relevant database table and its LIST page you use ..., make it a HIDDEN FIELD (READ ONLY)

if you can, say, you need to own a field into which the event oriented code can inject the user's fullname

(or name of what you have titled the field name to be), otherwise no chance for the event oriented code to

deliver a result.
Adjust the code provided by field and table name you are using. If done, you proceed to BEFORE RECORD ADDED

code entry screen as explained above to place the (adjusted to your needs) code. In other words, if your LIST

does not own a FIELD to be able to display the USER's name, the placement of the code would be useless.
Simply speaking, the easy web code generation of a tabled content along with fields to show is a basic feature,

by PHPRUNNER, such things work without any programming knowledge at all, yet EVENTS PROGRAMMING is something

different, so you need to inject manual code at the right place and event section.
Sounds a little bit complicated to new users, yet once the first successful code placement had been done, it

means that you have understood things for anything like that (events oriented programming) later on.

A
alghanim author 8/1/2020
HJB 8/1/2020





مركز الخليج


Simple, you need have a FullName field in place in your database table to let the code inject the result.
P.S. Check your USERS table to own a FullName field. If not, please install it.
Such ERROR pages do NOT exist, if you make good use of CHECK SYNTAX feature explained.

A
alghanim author 8/1/2020

I modified the code

$rs = CustomQuery("SELECT fullname FROM users WHERE ID=".$value."ID");

$record = db_fetch_array($rs);
$value = $record['fullname'];


Now it works

But the results page could not show the member
This code is included but not displayed

$_SESSION["fullname"]
HJB 8/1/2020



I modified the code

$rs = CustomQuery("SELECT fullname FROM users WHERE ID=".$value."ID");

$record = db_fetch_array($rs);
$value = $record['fullname'];


Now it works

But the results page could not show the member
This code is included but not displayed

$_SESSION["fullname"]



Is the results page a list page? If so, is a field name like "fullname" implemented in such list page?
What kind of code you so far had been placing within the BEFORE RECORD ADDED page? Trouble-shooting

would be much easier to view of what you had been using by coding.

A
alghanim author 8/1/2020

The problem is now showing the member on the view page or list page

HJB 8/1/2020



The problem is now showing the member on the view page or list page


Pleez check this:
1.) Does the LIST page own a field "fullname"?

2.) Owns the USER table a field "UserID" or just "ID"?

3.) Does the USER tabe own a field like "fullname"?
For better understanding, even if the SYNTAX CHECK is showing an OKAY,

it does not automatically mean, it works, simply because even correct

SYNTAX is nothing once the field names are incorrect respectively NOT

existing...
P.S. CASE SENSIVITY = UserID is NOT equal to userid or

userID, as well FullName is not equal to fullname and so on.
You need to check the field names and its correct spelling under one-by-one

terms in regard to USER table and LIST page fields and once done you need to

crosscheck the correct field names with the table/field names seen in the suggested

code. In other words, the code can only work once the field names are correct and

the fields are truly in place in the LIST/VIEW page.

A
alghanim author 8/2/2020

Thank you again

It seems complicated, I could not show the member who entered the record

Thank you again

I will try to find another solution

D
DealerModulesDevClub member 8/2/2020

Alghanimm take a look at this post from a few months back. It is similar to what you are trying to do. It may help.

Paul
https://asprunner.com/forums/topic/27168-add-username-via-editor/pagefromsearch1

A
alghanim author 8/4/2020
Security::getUserName()


Thank you, this code works

A
alghanim author 8/4/2020

The solution is to use the following values as in the following figure

$_SESSION["UserName"]



or

Security::getUserName()


The field is default and the user cannot modify it