SitePoint Sponsor

User Tag List

Results 1 to 18 of 18

Thread: tinyint problem

  1. #1
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    tinyint problem

    Hello,
    My db stopped accepting entries at subscriber ID 127 because my db type was set to tinyint which only goes to 128.

    I have changed it to an int which should accept 11 chars but everytime I try to add a new entry - i still get dupe entry for 127.....
    Any ideas ?
    "You know what you know - but that's all you know!"

  2. #2
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try using the following query
    PHP Code:
    ALTER TABLE your_table AUTO_INCREMENT 128 
    Paul

  3. #3
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't work mate....
    "You know what you know - but that's all you know!"

  4. #4
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you post your final table definition?

    Paul

  5. #5
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hope this is what your after....
    subscriberID int(9) NOT NULL auto_increment,

    I've tried different type and values for the field and the db is showing the changes (via myadmin).
    Just will not accept another entry.
    Mike
    "You know what you know - but that's all you know!"

  6. #6
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What query did you use to change the type of the field from tinyint to int?

    I created a test table trying to recreate your scenario and it worked for me.

    Paul

  7. #7
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    i used what you posetd earlier....
    ALTER TABLE subs AUTO_INCREMENT = 128
    in phpMyAdmin - reported success.
    Mike
    "You know what you know - but that's all you know!"

  8. #8
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by vbthanks
    Hi,
    i used what you posetd earlier....
    ALTER TABLE subs AUTO_INCREMENT = 128
    in phpMyAdmin - reported success.
    Mike
    No, that is not what I was asking for. Never mind, try the following queries
    Code:
    ALTER TABLE subs MODIFY subscriberID INT NOT NULL AUTO_INCREMENT
    
    ALTER TABLE subs AUTO_INCREMENT = 128
    then, try adding a new row.

    Paul

  9. #9
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Paul - thanks for your help - mucho habenero
    Tried what you said - db altered successfully - yet still cant get data in via form that was working okay up until tinyint filled-up.
    insert via phpmyadmin works okay.
    Mike
    "You know what you know - but that's all you know!"

  10. #10
    Happy Holidays !! Paul S's Avatar
    Join Date
    Mar 2001
    Location
    Mexico
    Posts
    1,287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by vbthanks
    Hi,
    Paul - thanks for your help - mucho habenero
    Tried what you said - db altered successfully - yet still cant get data in via form that was working okay up until tinyint filled-up.
    insert via phpmyadmin works okay.
    Mike
    weird, probably there's a minor problem with your php code (you might want to post it here).

    Paul

  11. #11
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay....
    Formhandler....
    PHP Code:
    <?
    include("conf.php");
    $date date("Y-m-d");

    $db mysql_connect($dbHost$dbUser$dbPass);
    mysql_select_db($dbName,$db);

    $query "INSERT INTO $table (subscriberID, date, name, email, age, gender, homeAddress, hPhone, wPhone, mPhone, workplace, wpAddress, state)
    VALUES
    (0, '
    $date', '$name', '$email', '$age', '$gender', '$homeAddress', '$hPhone', '$wPhone', '$mPhone', '$workplace', '$wpAddress', '$state')";
    // mysql error message was in here
    include ("v_entry_ok.php");
    ?>
    The form is okay....
    Mike
    "You know what you know - but that's all you know!"

  12. #12
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still isn't working for some reason. Does ayone have any ideas ? The db type for subscriberID is int
    mike
    "You know what you know - but that's all you know!"

  13. #13
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    subscriberID is AUTO_INCREMENT, yes?

    PHP Code:
    $query "INSERT INTO $table (date, name, email, age, gender, homeAddress, hPhone, wPhone, mPhone, workplace, wpAddress, state)
    VALUES
    ('
    $date', '$name', '$email', '$age', '$gender', '$homeAddress', '$hPhone', '$wPhone', '$mPhone', '$workplace', '$wpAddress', '$state')"
    You don't usually need to define the name or value of an AUTO_INCREMENT field.
    Ian Anderson
    www.siteguru.co.uk

  14. #14
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried what you said SiteGuru - No go mate....
    Mike
    "You know what you know - but that's all you know!"

  15. #15
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump

    Can anyone help with this ?
    Regards,
    Mike
    "You know what you know - but that's all you know!"

  16. #16
    Now with customized title Jump's Avatar
    Join Date
    Sep 2002
    Location
    The Restaurant at The End of The Universe
    Posts
    1,423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had this problem just last week. I deleted the id field and created a new one. It filled all the existing fields with new id's #'s and has been working since.

  17. #17
    SitePoint Zealot vbthanks's Avatar
    Join Date
    May 2001
    Location
    Sydney
    Posts
    170
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fixed.
    Created a new table (same as first) but with subscriberID set to INT, and it works fine.
    First table field type had changed to INT, but was trying to insert the next entry from the form handler with an ID that was already in-use, thereby giving me a dupe entry error.
    Thanks all,
    Mike
    "You know what you know - but that's all you know!"

  18. #18
    Your Lord and Master, Foamy gold trophy Hierophant's Avatar
    Join Date
    Aug 1999
    Location
    Lancaster, Ca. USA
    Posts
    12,305
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Could have gotten the same effect by deleting the index and re-adding it later.
    Wayne Luke
    ------------



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
  •