This topic is locked
[SOLVED]

 default value

4/21/2018 9:51:40 AM
PHPRunner General questions
R
reimic author

Hi,

I need your help! Thank you

there are 4 tables

the "credentials" table it's for this connect

the "personel" table is the list of users with an assignment to a department.

the "departement" table is the list of departments

the "encodage" table is the tasks that each user saves. it can encode a task on another department.



I don't know how to do it


and in EVENTS / encodage / add page / add page: Before process



global $conn;

$strSQLExists = "select * from credentials where login='".$_SESSION["UserID"]."'";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);

$strSQLExists1 = "select * from personnel where personnel_id='".$data["personnel"]."'";

$rsExists1 = db_query($strSQLExists1,$conn);

$data1=db_fetch_array($rsExists1);

$strSQLExists2 = "select * from personnel where departement='".$data1["departement"]."'";

$rsExists2 = db_query($strSQLExists2,$conn);

$data2=db_fetch_array($rsExists2);
if($data2)

{

// if record exists do something

$values["departement"] ;

}

else

{

// if dont exist do something else

}
// Place event code here.

// Use "Add Action" button to add code snippets.
admin 4/23/2018

This can be done but you cannot use $values[...]. Run your code, save result in session variable and then use that session variable as a default value.

R
reimic author 5/7/2018



This can be done but you cannot use $values[...]. Run your code, save result in session variable and then use that session variable as a default value.


Hi Sergey,

Thank you, but I don't know how to do it

admin 5/7/2018

It does work, but you need to implement it properly. Your syntax need to be correct, you need to use a proper event to populate session variable.
The code you posted is meaningless. You are executing some queries but not doing anything at all with data you retrieving.

R
reimic author 5/8/2018



It does work, but you need to implement it properly. Your syntax need to be correct, you need to use a proper event to populate session variable.
The code you posted is meaningless. You are executing some queries but not doing anything at all with data you retrieving.


I think I'll open a ticket so you can help me. you will take 2 minutes but me too many hours. Thank you.

R
reimic author 5/9/2018

Very thank for you support.

It's working.

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