SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wierd mySQL update problem with PHP form in Dreamweaver MX

    Hi all,

    I'm experiencing a weird UPDATE problem with a form that I have set up in Dreamweaver MX. I'm using the Update Record Server Behaviour to run an update to a table of registrants for a conference. The problem is this:

    When I first go to the update page and make any necessary changes, it works fine. But if I go back to the update page and try to update it a second time, all the default data is not found. This also happens on a separate page where I'm not doing an update form, but simply using recordsets to display the data. All of that data disappears too once the registrant record is updated.

    The data is still present in my mySQL database, it's just not displaying properly. I'm not sure whether the problem is in the SELECT statement or in the code written to the Update Record Server Behaviour.

    I won't post any code at this point, because I'm not even sure what code would be most helpful. I have many tables, with my registants table in a one-to-many relationship with data like gender, provinces, birth months, birht dates (days in a month), etc.

    I'm just confused as to why the data would disappear from my display and update pages once it's been updated.

    Please help - I need to figure this out fast...

    Thanks in advance,
    Michael.

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this is a PHP question and not mysql, you may want to ask a moderator to move this query for you.

  3. #3
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dave, I wasn't sure where to post this, because I wasn't sure if the problem lay with the Select statement and the recordset, or with the php display code.

    Moderator, if this is more suitable for the PHP forum, please feel free to move it. Thanks.

    Michael.

  4. #4
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Update: OK, I think this has something to do with the "id" (primary key) field not getting passed properly in the Update form. The weird thing is that the "id" field doen't change in the database, but once the record is updated, that field is not getting passed properly to the browser, so both the View and Update pages are blank because both the pages are dependent upon a URL parameter being passed (which is showning correctly in the address bar - ex. details.php?id=00001).

    Any thoughts?

  5. #5
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, this is blowing my mind. These records that have been updated will show up on other pages that include their record, including a summary page that lists their name and date registered (which, ironically, is the page I use to go to the details page and update page!), as well as other group summary sheets. It's just the 2 pages - the update and detail page. I just recreated the whole detail page, and it's still doing the same thing - for those who have been updated at some point, the record displays blank like no ID has been passed. For those who have been inputted but never updated, the record displays fine.

    The only thing that makes sense to me is there's some sort of "flag" in the updated records that's preventing them from being displayed properly in these pages. But the only thing that I can think of is that there is a "date_registered" field and a "date_last_modified" field. These are present and hold valid and correct data in the database - the "date_last_modified" field is only written to when the update page is executed. But I can't figure out why that would have an effect.

    If anyone can shed some light or point me in the right direction, I'd really, really appreciate it.

    Michael.

  6. #6
    SitePoint Member
    Join Date
    Aug 2004
    Location
    Kelowna, BC, Canada
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I got it. Chalk it up to my inexperience with mySQL. I won't go into details, but the basics of it is that when I updated a record, there were two columns that were getting updated with Null values. Then when I was listing them on the detail and update page, the recordset was trying to compare the values against a related tables that needed to have integer values in that field. So it wrecked the whole recordset.

    So simply changing the values from Null to an accepted integer solved the whole thing for the Detail page. For the Update page, I just had to simplify the query a whole lot and it did the trick.

    Thanks, and my apologies, to anyone who spent brain power on this

    Michael.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •