Ezra
|
| Posted: 07/09/2002, 9:19 AM |
|
Im setting up a new session var but im having problems
in the login i have:
-------------------------------
$sLogin = get_param("Login");
$sPassword = get_param("Password");
// i have included the field "client_id" in this query
$db->query("SELECT login_id,security_level,client_id FROM login WHERE User =" . tosql($sLogin, "Text") . " AND Pass=" . tosql($sPassword, "Text"));
$is_passed = $db->next_record();
if($is_passed)
{
//-------------------------------
// Login and password passed
//-------------------------------
set_session("UserID", $db->f("login_id"));
set_session("UserRights", $db->f("security_level"));
// here i included the new variable
set_session("cid", $db->f("client_id"));
in the where i want to use this client_id i have used a imput parameter with the settings:
client_id | cid | session | number | required | transfer
the result is this:
Database error: Invalid SQL: insert into briefing (client_id,briefing_id,client_id,estado,Data,Descri,Target,Responsavel,Prazo) values (NULL,NULL,NULL,'stand by','09-07-2002','qewqew','qewqew','qewqew','qewqew')
MySQL Error: 1110 (Column 'client_id' specified twice)
Session halted.
Even if i go the code and remove the duplicate fields, the value is still NULL
it seems to me that im doing all right...but i guess not...
Any help?
|
|
|
 |
Nicole
|
| Posted: 07/10/2002, 1:03 AM |
|
Ezra,
Input variables on Record form works in different way from the Grid form. Once you add Input parameter on the Record, it won't be included into Where clause. If you mark it as 'Transfer' it will be passed to the result page through url. If you mark it as 'Required' it will be included into sql query. Note, that if you have added the same field to the form and set its type to updatable (not Label or URL), then the field will be included twice in the query.
Hence you can add client_id field as Input Required parameter and do not add it to the form.
The second workaround is to add client_id to the form (but not as Input parameter) and create Before Insert and Before Updates events like:
$fldclient_id = get_session("client_id");
|
|
|
 |
|