lammy
Posts: 49
|
| Posted: 05/31/2005, 10:18 AM |
|
hello all
small problem
I have 2 tables
1 is members table with login details etc also has a field which contains the record id (primary key) of table 2
so each member owns 1 record from table 2
when user logs in it goes to the editable grid page
i then do the following
beforeshow (page) I declare variable to obtain the record number from the members table. this all works fine as I echo the value and its correct,
my problem is on the same page i have editable grid which i need to show the relevent record, so i do select statement so table2_id = $variable declared above (which has echoed correctly.)
I then get the following error
Notice: Undefined Variable: $variable in c:/programs etc
The varable is declared global it echos the right answer but in the grid it wont have it.
What am I doing Wrong could somebody help please
Cheers
lammy
|
 |
 |
mrachow
Posts: 509
|
| Posted: 05/31/2005, 12:14 PM |
|
Try
global $variable;
in your event first.
_________________
Best regards,
Michael |
 |
 |
lammy
Posts: 49
|
| Posted: 06/01/2005, 12:19 AM |
|
Hi M8
thanks for reply but I have declared the variable in the before show event on the page, I have got the record no and echoed the variable, all is correct,
its when i try and access the same variable on the grid which is on the same page as the declaration that I am having the problem, the grid cant see the variable because its says its undefined.
cheers
lammy
|
 |
 |
Nicole
Posts: 586
|
| Posted: 06/01/2005, 4:36 AM |
|
Lammy,
Do you mean that you use $variable in WHERE parameters settings? Or in custom event code?
_________________
Regards,
Nicole |
 |
 |
lammy
Posts: 49
|
| Posted: 06/04/2005, 7:04 AM |
|
Hi Nicole
i declare the variable in custom code in before show on the page ie
global $editdetails;
global $recordname;
global $DBdatabase;
$recordname = CCDLookUp("admin", "members", "member_id=".
$DBdatabase->ToSQL(CCGetUserID(), ccsInteger), $DBdatabase);
echo $recordname;
this part gives me the right no within $recordname so works fine
further down page I have my editable grid with this sql statement set in the editable record properties.
SELECT *
FROM databasetable
WHERE ( recordid = '$recordname' ) // recordid is my primaryindex name it is autoinc
this is when i get the Notice: Undefined variable: recordname in c:/programfiles/apache etc
basically once I have the record no in $recordname I want to show that paticular record for editing in the grid.
Cheers
lammy
|
 |
 |
mrachow
Posts: 509
|
| Posted: 06/06/2005, 12:52 AM |
|
Quote :further down page
Are you inside the same (event) function?
You have to give global ... for every event you would like to use it.
An additional remark only.
When inclosed in single apostrophes php varibles want get expanded!?
_________________
Best regards,
Michael |
 |
 |
MarvP
|
| Posted: 06/24/2005, 4:15 AM |
|
hi...im a new user with JSP and SQL. im selecting records from a sample table which has an unique ID column,First name and a last name.
my query returns should only return the first name and the last name.
this is what i am writing in my jsp page..\
...
<%while(recresult.next()){%>
<%=recresult.getString(1)+" "+recresult.getString(2)+"<br>"%>
...
if i go any further i get an invalid descriptor index....i guess that is because the ID column comes next and my query doesnt want that...
how do i go about the next line and select only the first name and last skipping the ID column....
id love it if someone could help me!! :)
|
|
|
 |
|