This topic is locked

order signing limit

7/18/2005 06:44:01
PHPRunner General questions
adamdidthis author

Hi,
I have almost finished my database now.
The only thing left is to enfor a authorisation limit.
The database consists of three tables, the main order form, a list of people who can authorise an order and a list of departments.
The authorisation list table also has a field in it called limit. this is the persons authorisation limit.
The main order form, has a drop down list in it to list the authorisation names. Is it possible to make it so that only a person with a limit higher that the total wll appear in the drop down?

Sergey Kornilov admin 7/19/2005

Hi,
you need to find this code snippet in the Order_edit.php file:

$rs=db_query($strSQL,$conn);

$data=db_fetch_array($rs);


and add this line

$_SESSION["total"] = $data["total"];


right after it.
Set Lookup Wizard WHEREexpression for Authorisation_names field as

"Limit >= " . $_SESSION["total"]
Total is the field in the Order table and Limit is the field in the People table.

adamdidthis author 7/19/2005

will this work if the total field is a calculated field?

Sergey Kornilov admin 7/20/2005

Yes, this will work if total is calculated field.

adamdidthis author 7/21/2005

ok i have done as you have said but it comes up with the following error:
Technical information

Error type 256

Error description You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Limit <= ORDER BY `username`' at line 1

URL intranet/departments/finance/database/auth/orderform_edit.phpeditid=4

Error file C:\Inetpub\wwwroot\newintranet\departments\Finance\Database\auth\include\dbconnection.php

Error line 26

SQL query select , (quant1 unit1) as mycost1, (quant2 unit2) as mycost2, (quant3 unit3) as mycost3, (quant4 unit4) as mycost4, (quant5 unit5) as mycost5, (quant6 unit6) as mycost6, (quant7 unit7) as mycost7, (quant8 unit8) as mycost8, (quant9 unit9) as mycost9, (quant10 unit10) as mycost10, (quant1 unit1) + (quant2 unit2) + (quant3 unit3) + (quant4 unit4) + (quant5 unit5) + (quant6 unit6) + (quant7 unit7) + (quant8 unit8) + (quant9 unit9) + (quant10 unit10) + delivery 0.175 as mvyat, (quant1 unit1) + (quant2 unit2) + (quant3 unit3) + (quant4 unit4) + (quant5 unit5) + (quant6 unit6) + (quant7 unit7) + (quant8 unit8) + (quant9 unit9) + (quant10 unit10) + delivery * 1.175 as mytotal From `orderform` where `ordnum`=4
Any ideas?

Sergey Kornilov admin 7/21/2005

Hi,
you forgot to replace totalwith actual field name:

$_SESSION["total"] = $data["mytotal"];

adamdidthis author 7/25/2005

Ok have made that change but am now getting the following error

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Limit >= 103367.500 ORDER BY `username`' at line 1
Sergey Kornilov admin 7/25/2005

Hi,
please zip and send your php files and database creation script to support@xlinesoft.com for investigation.

adamdidthis author 7/25/2005

email sent

Sergey Kornilov admin 7/25/2005

Adam,
since "Limit" is MySQL reserved word it should be taken in wrappers.
So please open PHPRunner, go to Formatting tab and change Lookup Wizard WHERE expression for Authorisation_names field from

"Limit >= " . $_SESSION["total"]



to:

"`limit` >= " . $_SESSION["total"]
adamdidthis author 7/25/2005

email sent