This topic is locked

check on duplicate

5/5/2008 2:01:55 PM
PHPRunner General questions
E
echo author

hello. i have table which has many fields, but i need to check on 1 field wether a client enters a record that already exists. if it does, then issues an error like ' record already exists '. i know how to do this in php and working with triggers, but this prog has me scratching my head trying to follow the logic. in php i would have done this as a before trigger and just checked for dup entry in field. where i am having trouble is trying get to grips with phpr vars and smarty way of working. any help greatfully appreciated. cheers

Sergey Kornilov admin 5/5/2008

Put your code to BeforeAdd event ('Events' screen in PHPRunner).

E
echo author 5/5/2008

thx admin. would it be standard php code? or some phpr variation of php? also, why is this code not working in lookup manager?
[codebox]"customer = ".$_SESSION["UserID"][/codebox]
it says "unable to retrieve data using the where condition you've entered. all records are displayed"
Thank you

Sergey Kornilov admin 5/5/2008

That would be a regular PHP code. Check events documentation to find what parameters are passed to Events.
If think you miss single quotes aroud user id

"customer = '".$_SESSION["UserID"] . "''
E
echo author 5/5/2008

still the same error. used
[codebox]"customer = '".$_SESSION["UserID"] . "''[/codebox]
what i need to do is show the department name based on the logged in user. do you have sample code for dup record check so i know what variables are used? many thanks

J
Jane 5/6/2008

Hi,
your code looks correct.

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

E
echo author 5/6/2008

hello jane.i am working localhost, is that a problem?

J
Jane 5/6/2008

Hi,
to upload your files to the Demo Account click on the corresponding button on the last tab in the PHPRunner.

E
echo author 5/6/2008

ok. thanks jane.

E
echo author 5/6/2008

jane. i have uploaded to dmo account. but when i click the link for project it errors with:
[codebox]Parse error: parse error, unexpected '"' in C:\UserAccounts\www\**\Project1_20080506070057\include\commonfunctions.php on line 121[/codebox]
i have replaced email address with **. what do i do now? thanks

Sergey Kornilov admin 5/6/2008

Correct one:

"customer = '".$_SESSION["UserID"] . "'"
E
echo author 5/7/2008

admin. still not working. let me explain further what i am doing, because it could be my fault. in my project i have a table called 'box'. in that table there are 3 fields: 'department', 'customer', 'status'. what i am trying to is, on the deparment field is by double clicking, i then go to 'edit as' and select 'lookup wizard'. i then select the 'departments' table and select link field 'code' display field 'name' order by 'name' and in the where clause enter "customer = '".$_SESSION["UserID"] . "'" all that does is bring a blank dropdown box which refuses to close or cancel. i have to restart the lookup wizard to resume. am i doing anything wrong? thanks

J
Jane 5/7/2008

Please send a URL to your pages along with instructions on reproducing this error to support@xlinesoft.com.

E
echo author 5/7/2008

i've already done that jane. i am on localhost for production. i uploaded to demo account. also, i have listed my actions to produce error in previous post. thank you.

E
echo author 5/7/2008

any further help with this error? thanks

J
Jane 5/8/2008

Hi,
I can't locate your email. Please re-send it.

E
echo author 5/8/2008

jane. with all due respect. i have hilighted in my post exactly what i did to produce the problem. why do i need to send another mail? all i need to know, is am i doing it correctly? many thanks

E
echo author 5/8/2008

jane. sent what you requested by mail. thank you.

J
Jane 5/8/2008

answered in your personal email.

E
echo author 5/8/2008

jane. info sent as requested. thanks

E
echo author 5/9/2008

any help on this yet? thanks

E
echo author 5/9/2008

hello. can you help with this? thanks