38 users online (0 members and 38 guests)  


  Results 1 to 6 of 6

Related

  1. Fade-effect    Forum: Javascript Forum
    Replies: 0
  2. === type comparison in mysql?    Forum: Databases
    Replies: 6
  3. Cool effect. How did they do it?    Forum: Javascript Forum
    Replies: 1
  4. Upgrading forums    Forum: CGI Perl Forum
    Replies: 8
  5. Rollover Effect    Forum: HTML Forum
    Replies: 12
  1. #1
    snowweb's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    7

    upgrading MySQL column type has no effect

    I've created a web page in .php which receives it's content from a MySQL database, it is all working nicely and looking good except that a field which I have called Ed_Main is now about 65kb and now does not display all the text stored in it.

    I'm using PHPMyadmin to administer MySQL.
    MySQL version 4.0 (CGI setup)
    MySQL installed on local machine (high-end Pentium laptop)
    IIS installed on local machine
    OS - XP Pro SP2
    Browser: IE6

    I was creating my content in an external application then I 'Browsed' in PHPMyadmin for the relevant record and pasted it into the field in PHPMyadmin directly. I did it this way as I've not yet created any input pages for updating the web site.

    The field in PHPMyadmin seems to accept my entire text and when I navigate back to that field again after saving the record, indeed, the text was saved. So I then check my .php page to view the out put and find that my content has been truncated. It seems to make no difference whether I add more text, it still truncates in the same place, so I assume it is a size issue (although, isn't it odd that my ENTIRE text seems to be stored ok in the database, since I've been back via PHPMyadmin to look at it!)

    Anyway, I then changed the field type using PHPMyadmin from 'Text' to 'MediumText' and saved my changes. The situation is still identical, although PHPMyadmin indicates that the change was successful. I have also run the repair option on the database with no improvement.

    As I said, my text is currently about 65kb (although I need to add about another 40kb to it), so the MediumText field which holds about 16mb, should have no bother holding it.

    Does anyone know the answer to this? I spent the entire day searching online and can find nothing of any help!

    Thanks

    peter


  2. #2
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: upgrading MySQL column type has no effect

    If you're sure the entire text is being stored in your MySQL database, then your problem could be with your PHP page instead. Post the rendered code for the page in question. Maybe there's something in the page that can be fixed to cure this problem.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  3. #3
    snowweb's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    7

    Question Re: upgrading MySQL column type has no effect

    Quote Originally Posted by vinyl-junkie
    If you're sure the entire text is being stored in your MySQL database, then your problem could be with your PHP page instead. Post the rendered code for the page in question. Maybe there's something in the page that can be fixed to cure this problem.
    Thanks vinyl-junkie, here is the code that is rendered:
    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    <?
    $item=$_GET['item'];
    $username="*******";
    $password="******";
    $database="********";
     
    /* Connecting to a database and retrieve data */
    $conn=odbc_connect($database,$username,$password);
    if (!$conn)
    {exit("Connection Failed: " . $conn);}
     
     
    $sql="SELECT * FROM products WHERE ProdID='1'";
     
    $rs=odbc_exec($conn,$sql); 
    $Ed_Main=odbc_result($rs,"Ed_Main"); 
     
    echo "ed_main is ". strlen($Ed_Main)." characters long"; 
    $rs=odbc_exec($conn,$sql);
    $Ed_Main=odbc_result($rs,"Ed_Main");
    echo "<br>$Ed_Main";
    odbc_close($conn);
    ?>
    </body>
    </html>
    I have attached a text file containing the full text that is in the database but is being truncated at character 4095. The last text dislayed is
    For enhanced night time viewing, pressing the backlight key illuminates the LCD display and keypad, and if no other keys are operat
    immediately after that is
    or.</p>
    <p></p>
    <div style='font-size:1.0em; color:darkgreen;'><b><i>Versatility...
    Thanks for you your help

    password removed
    Attached Files Attached Files
    Last edited by HTML; 01-22-2006 at 08:38 PM. Reason: private information removed

  4. #4
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: upgrading MySQL column type has no effect

    When I said to let us know what the rendered page looked like, I meant what it would look like when you did a View Source from your browser.

    How is your database table defined? (You can find this information in phpMyAdmin, or whatever product you use to browse the database from your web hosting account.) I've been looking at the field definition information in the manual and I don't see any definition that would limit the characters in a field to 4095. That's why I was thinking that perhaps you had something in your HTML that was causing the problem.

    I'm grasping at straws because I have no idea what the problem could be.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  5. #5
    snowweb's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    7

    Thumbs up Re: upgrading MySQL column type has no effect

    Quote Originally Posted by vinyl-junkie
    When I said to let us know what the rendered page looked like, I meant what it would look like when you did a View Source from your browser.

    How is your database table defined? (You can find this information in phpMyAdmin, or whatever product you use to browse the database from your web hosting account.) I've been looking at the field definition information in the manual and I don't see any definition that would limit the characters in a field to 4095. That's why I was thinking that perhaps you had something in your HTML that was causing the problem.

    I'm grasping at straws because I have no idea what the problem could be.
    Sorry about that! I know for next time now
    I've had a break through this morning! I have changed my connection method to mysql_connect from odbc_connect and that seems to have completely fixed it!
    I don't think I'll be using odbc again unless I have to!
    Thanks for all you help and patience with me.
    Kind regards
    pete

  6. #6
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: upgrading MySQL column type has no effect

    Although you have fixed it, it would be helpful for anyone reading this thread to know why that worked.
    I don't know the answer, but it is significant that the text stopped on character 4095 = i.e. the truncation is 4096 (with a 0 start) characters in length which is 2^12.
    This makes it appear to be a limitation of either the variable you read it in to, or the function you used to read it.



Tags for this Thread