PDA

View Full Version : Child list stays empty


biesheuvel378713
07-23-2010, 05:51 AM
I've followed the tutorial (PDF) and constructed a page with to list menu. Now the dynamic array stays empty.

Copy from FireBug:

var WAJA = new Array();
3WAJA[0][] = new Array();
4WAJA[0][][0] = '';
5WAJA[0][][1] = '';
6WAJA[0][1] = new Array();
7WAJA[0][1][0] = '';
8WAJA[0][1][1] = '';
9WAJA[0][2] = new Array();
10WAJA[0][2][0] = '';
11WAJA[0][2][1] = '';
12WAJA[0][3] = new Array();
13WAJA[0][3][0] = '';
14WAJA[0][3][1] = '';
15WAJA[0][4] = new Array();
16WAJA[0][4][0] = '';
17WAJA[0][4][1] = '';
18WAJA[0][5] = new Array();
19WAJA[0][5][0] = '';
20WAJA[0][5][1] = '';
21WAJA[0][6] = new Array();
22WAJA[0][6][0] = '';
23WAJA[0][6][1] = '';
24WAJA[0][7] = new Array();
25WAJA[0][7][0] = '';
26WAJA[0][7][1] = '';
27WAJA[0][8] = new Array();
28WAJA[0][8][0] = '';
29WAJA[0][8][1] = '';
30WAJA[0][9] = new Array();
31WAJA[0][9][0] = '';
32WAJA[0][9][1] = '';
33var users_WAJA = WAJA;
34WAJA = null;

Is there something that I've done wrong? I checked the recordsets and they all contain data and also checked the database.

I use DW CS5 on a Vista machine..

Jason Byrnes
07-23-2010, 07:30 AM
your users query only returns the id, lastname and groupid

$query_users = "SELECT id,lastname,groupid FROM da_user ORDER BY lastname asc";


PHP is a cse sensitive language. in the code for the dynamic array, it is using the "groupId" column.

$newmainid = $row_users["groupId"];


it should be a lower case i "groupid"

also, it is using the "ID" column instead of "id":
echo "WAJA[".$n."][".$m."][0] = "."'".WA_DD_Replace($row_users["ID"])."'".";\n";

and the "Name" that is not returned by the recordset:
echo "WAJA[".$n."][".$m."][1] = "."'".WA_DD_Replace($row_users["Name"])."'".";\n";

biesheuvel378713
07-23-2010, 08:06 AM
Thanks for the reply, i've started al over again and noticed the following:

I have a query like:

SELECT id, name, groupID from da_users ORDER BY name

Now if I open de dialog to create a dynamic ARRAY it changes id into ID and name into Name. After clicking ok it also writes ID and Name into the code.

When I adjust the code into name and id (lowercase) everything works fine. Even when reopening the dynamic array dialog it displays the record in lowercase as in the query.

I'm glad that i found it so I can pay attantion to it, it's just a litle bug in the dialog.

Thanks for helping me on my way, it's a great tool. I'm used to asp.net and now learning php so this sort of tools gets me on my way quickly!

Greetz,

Jason Byrnes
07-23-2010, 08:13 AM
How are the columns named in the database? The Dynamic dropdowns extension just looks at what the name is in the database, not the name in the SQL statement.

SQL is not as case sensitive as PHP is.

So if the name in the database is ID
SELECT id will still work.

but the php code will need to use the SQL case, not the database case.

biesheuvel378713
07-23-2010, 08:26 AM
Okay, so the dialog allways looks at the naming convention of the database and not the query. Well at least I know now.

(Since I use this site for testing I didn't use the naming convention lowercase/uppercase that serious. Its best to write the query with the same naming convention as the database)

Thank you very much for your help!

Jason Byrnes
07-23-2010, 09:19 AM
you're welcome.