ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Wrong entry_id being saved for relationship

October 29, 2007 4:35pm

Subscribe [2]
  • #1 / Oct 29, 2007 4:35pm

    Ben Kimball (UT)

    33 posts

    One of my weblogs has a relationship with another weblog (which is in a different site). When I submit a value for this relationship using the dropdown menu, a (seemingly) unrelated integer is stored in the database. Yet somehow when I reload the Edit form, the correct item is selected in the dropdown menu.

    I’m totally baffled.

    So, in the Edit form, I’m seeing:

    <select name='field_id_73' class='select'>
    <option value='124' selected='selected' dir='ltr' >Robert Mitchell</option>
    ...(more options)...
    </select>

    And when I submit that form, what actually gets stored in MySQL is a row that looks like this:

    entry_id: 104
    field_id_73: 742 # WTF?

    What’s more, it seems that each time I submit the Edit form, the integer stored in field_id_73 for that entry increments by some arbitrary amount. Just now it went from 742 to 745.

    Help, please! My production deadline in is 2 hours.

    Best,
    Ben

  • #2 / Oct 29, 2007 4:36pm

    Ben Kimball (UT)

    33 posts

    Er, I should add that the problem, of course, is that I can’t fetch related_entries using this ID, because the value of the ID in the database is wrong, even though it’s correct in the Edit form.

  • #3 / Oct 29, 2007 4:38pm

    Ben Kimball (UT)

    33 posts

    Also, it seems that the value always increments by 3.

  • #4 / Oct 29, 2007 4:40pm

    Lisa Wess

    20502 posts

    Hi, Ben - what version and build of EE are you running, and are you running any extensions?

  • #5 / Oct 29, 2007 4:43pm

    Ben Kimball (UT)

    33 posts

    Hey Lisa. Sorry for not including this. I’m running 1.6.0 build 20070918.

    It looks like my diagnosis was off; field_id_73 appears to hold the ID of the relationship record, not the entry_id of the related record. So that’s as it should be. But I’m still unable to pull related data using the field.

    It’s especially odd because all my other relationships are working properly.

    Thanks,
    Ben

  • #6 / Oct 29, 2007 4:50pm

    Ben Kimball (UT)

    33 posts

    A clue!

    This does not work:

    {if eventgroup_speaker}
    {related_entries id="eventgroup_speaker"}
    <strong>Seminar Director:</strong> {speaker_bio}
    {/related_entries}
    {/if}

    This does work:

    {if eventgroup_speaker}
    {related_entries id="eventgroup_speaker"}
    <strong>Seminar Director:</strong> {field_id_72}
    {/related_entries}
    {/if}

    I tried that after looking in the cached relationship data in the relationships table and seeing that the field names weren’t set in there.

    Cheers,
    Ben

    P.S. I’ve tried resetting my relationship caches from the control panel already. No dice.

  • #7 / Oct 29, 2007 6:45pm

    Derek Jones

    7561 posts

    Ben, is it possible to email (not PM) me Super Admin and FTP access so I can step through and troubleshoot where in the code it’s breaking down?

  • #8 / Oct 29, 2007 6:52pm

    Ben Kimball (UT)

    33 posts

    Ben, is it possible to email (not PM) me Super Admin and FTP access so I can step through and troubleshoot where in the code it’s breaking down?

    I can do Super Admin and phpMyAdmin, but I don’t think I can do FTP, at least not without more consideration. Would that help, or do you need to fiddle with source files directly?

    Thanks!
    Ben

  • #9 / Oct 29, 2007 7:01pm

    Derek Jones

    7561 posts

    I’d absolutely need FTP, as I cannot break out of the code with debugging information unless I have access to the source.  Cruising as a Super Admin through the templates and content might reveal something, but it’s not likely, and would take much more time since I have no familiarity with your weblogs, custom fields, templates, etc.  But obviously it is your prerogative; just offering the fastest avenue since you are on a time crunch.

  • #10 / Oct 29, 2007 8:01pm

    Derek Jones

    7561 posts

    Ben, as your deadline has come and gone, I hope you found a solution for your launch.  Let me know how I can assist from here.  Also, as one of Lisa’s earlier questions might still be relevant, are you running any extensions?

  • #11 / Oct 30, 2007 11:55am

    Ben Kimball (UT)

    33 posts

    Thanks Derek. Yes, for launch, we just used {field_id_nn} in place of the field name inside the {related_entries} tag pair. I still hope to get you source access, just not sure it will be possible because of our infrastructure.

    I’m not running any extensions, though I am running one 3rd party module (User, from SolSpace) and one custom plugin of my own design. That plugin, which handles user registration for seminars, is only invoked on one template, which isn’t involved in this problem (I assume).

    Oh—I’m also running the patch you sent me earlier this month for the member import respecting email nonuniqueness! I forgot about that. So it’s not straight 20070918.

    In the exp_relationships table, should rel_data hold field names and values, or column names and values? I’m assuming the latter, since that’s what appears in the relationships I have that are working, too. That is to say,

    s:11:"field_id_26";s:61:"The season will close with…"
    as opposed to
    s:17:"event_description";s:61:"The season will close with…"

    Cheers,
    Ben

  • #12 / Oct 30, 2007 12:04pm

    Derek Jones

    7561 posts

    Yes, it holds the column name, not the variable’s short name.  The match-up all occurs behind the scenes in the Weblog module.  I know you guys have a tight ship there with regard to external access, so that’s understandable.  If you can set me up with a Super Admin account, I can create an access restricted test template and try some back end troubleshooting.  To expedite the process, you can go ahead and create that test template, doing so as a copy of the problem template.

  • #13 / Oct 30, 2007 12:26pm

    Ben Kimball (UT)

    33 posts

    Cool. I’ve just sent you an email with credentials.

    Thanks!
    Ben

  • #14 / Oct 30, 2007 6:24pm

    Ben Kimball (UT)

    33 posts

    Followup: this issue is resolved. My problem (in case it helps future generations of hackers) was that I’d broken my database content by running a custom SQL query to update exp_weblog_titles with a new site_id for a batch of entries without also updating exp_weblog_data with the same site_id.

    Or, from a different perspective, my problem was that I’d hacked around in the database without a comprehensive understanding of the EE schema.

    At any rate, many thanks to Derek for going to a lot of trouble for what was, in the end, not his problem at all.

    Cheers!
    Ben

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases