Referencing DB field gives different results on Dev Site and Live Site

Sorry, but my mind is pickled and can’t remember exact terms, so I’ll try to explain

So you can refence a DB record inside a dmx-repeat like this[0]

and like this[0].list_label

And so I am referencing from a list where address_type is a number[address_type].list_label

This gives results and is correct on the Live Site but on my Dev machine I have to reference it like[address_type - 1].list_label to get the correct result.

Any idea what I am doing wrong? Is it a MySQL setting? phpMyAdmin setting? ini.php? Help guys, I’m scratching my head.

Hi Neil,

Assuming the underlying data is exactly the same, maybe it is a difference in the default ordering of MySQL. It looks like you are relying on the position of the data, so if you are not specifying the sort order, you open yourself up to differences from different versions or different table types.

If you are already setting a sort order, then I’m stumped.



Hi Ken, yes the data is the same, there is no sort order so will try your suggestion, cheers.

Although the structure might be the same, you seem to have different data on the dev and live site. Seems on the life site you are having an extra record.

Hi guys, you’re right, I was doing it all wrong. I was referencing the index rather than the ID of the row.

OK, so what I have is a DB Table with a list, this list is used to generate SELECT menus all over the site and works well. So there is a Server Action which finds all items in the table. I then have Server Connect at the top of the page which brings in the list. Here is part of the DB Table


In a SELECT I use'menu_id', 31, "==") which will populate a menu with the items from the screenshot above.

What I am trying to do with this post is simply display on a page one Menu List Item. So for instance I want to display menu_list_item 162 = “Management”.

This is where I thought I could use[162].list_label but of course this references the index of the returned list and not the menu_list_id.

I have tried things like {{'menu_list_id', 162, "==").list_label}} but this doesn’t work. Any guidance would be much appreciated.

Try this'menu_list_id', 162, "==")[0].list_label
1 Like

BRILLIANT ! That works.
A big Gold Star :star: for that man
Thank you

I am actually using this now
{{'menu_list_id', address_type, "==")[0].list_label}}
which uses the number from address_type in another query to reference the required item.

1 Like

Great! Just have to remember that a where operation returns a collection, so when searching for a single item, you just have to select the first item in the collection.

1 Like