Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Re-created table failing

    Re-created a table in my database.
    All field names and values are identical to the original table.
    Table name is correct too.

    Now the web-pages will not store data to the table.

    I don't know why?

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,631
    Thanks
    4
    Thanked 147 Times in 138 Posts
    well you can't have two tables with the same name in the same database. either you have given a different table name or you have used a different database. which is it?

    did you modify your php or whatever code to reflect that difference?

  • #3
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    what's the tablename + what OS are you on + did you use a db-frontend and which one?

    also, can you post the errormessage that you get when you zre trying an insert?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    I "Dropped" the original table from the database (I'm assuming that "Drop" is another way of saying delete. The MySQL Query Help didn't elaborate much.)

    Having dropped the table, I created a new table; identical in every way.
    Tests have proven that I can pull and view records (which are inserted driectly into the table) but I can't edit them.
    The webpage code hasn't changed. Nor have the Database permissions.

    Baffled by the weirdness.
    Using MySQL 4.1 with Apache 2.0.58



    Quote Originally Posted by guelphdad
    well you can't have two tables with the same name in the same database. either you have given a different table name or you have used a different database. which is it?

    did you modify your php or whatever code to reflect that difference?

  • #5
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by h8ids
    I "Dropped" the original table from the database (I'm assuming that "Drop" is another way of saying delete. The MySQL Query Help didn't elaborate much.)
    DROP tablename
    will mean that the table and all its indexes is deleted

    TRUNCATE tablename
    will mean that all records are deleted (for InnoDB) OR that the table is dropped + automatically recreated (for the other storage engines (because this is often faster then deleting the records and undating the indexfiles))

    DELETE FROM tablename
    will mean that all records are deleted.

    Seems to me that you actually want FRUNCATE or DELETE FROM ...
    maybe try these and see if the problem persists.

    Quote Originally Posted by h8ids
    Tests have proven that I can pull and view records (which are inserted driectly into the table) but I can't edit them.
    Can you elaborate on this? How did you test it? What do you mean by 'inserted driectly into the table'?
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

  • #6
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    No error message appears.
    Webpages are coded with

    error_reporting(E_ALL);
    error_reporting(E_ALL | 'E_STRICT');

    php.ini has the following line activated.

    error_reporting = E_ALL
    display_errors = On
    display_startup_errors = on
    log_errors = On

    There are no errors listed in the Administrator error log.


    Quote Originally Posted by raf
    what's the tablename + what OS are you on + did you use a db-frontend and which one?

    also, can you post the errormessage that you get when you zre trying an insert?

  • #7
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Raf,

    Since the original table has been Dropped and no longer appears in the DB, would Truncating the new table resolve the problem?
    Hoping I don't have to re-create the table or the DB.

    I'm able to edit the DB directly through the MySQL Query tool. I inserted a record to see if my webpage would pull the data; it did. But I can't edit the record nor can I save a new record.

    Can you elaborate on this? How did you test it? What do you mean by 'inserted driectly into the table'?

    Quote Originally Posted by raf
    DROP tablename
    will mean that the table and all its indexes is deleted

    TRUNCATE tablename
    will mean that all records are deleted (for InnoDB) OR that the table is dropped + automatically recreated (for the other storage engines (because this is often faster then deleting the records and undating the indexfiles))

    DELETE FROM tablename
    will mean that all records are deleted.

    Seems to me that you actually want FRUNCATE or DELETE FROM ...
    maybe try these and see if the problem persists.


    Can you elaborate on this? How did you test it? What do you mean by 'inserted driectly into the table'?

  • #8
    Regular Coder
    Join Date
    Jan 2006
    Posts
    251
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    Dropped the new table.
    Created a third table; same name and fields.

    Tested the submission page and voila, it now works...

    Strange!

    Thanks guys.

  • #9
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by h8ids
    Since the original table has been Dropped and no longer appears in the DB, would Truncating the new table resolve the problem?
    depends on what the problem is.
    but it seams to me you're reinventing the wheel --> truncate does automatically what you are doing now.
    Quote Originally Posted by h8ids
    I'm able to edit the DB directly through the MySQL Query tool. I inserted a record to see if my webpage would pull the data; it did. But I can't edit the record nor can I save a new record
    yes, but are you using the same user in MySQL Query as in PHP?
    for instance, if you logi to the MySQL Query tool as root, and you use some useraccount with fewer permissions in your mysql_connect(), then you might have different permissions for that table...
    Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html


  •  

    Posting Permissions

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