Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 3 of 3
  1. #1
    Member John Mc Grath's Avatar
    Join Date
    Sep 2011
    Location
    Ireland
    Posts
    80
    Member #
    29172
    Liked
    3 times

    Is 'strlen' a good operation?

    Hi, just a quick question. Is strlen a good operation for min and max characters? I am just asking because I have a comment box that works fine with strlen when the min max are low around 10 25 but when I put them up to around what I need 1500 10000 then the query fails when trying to write to the database.

    Just wondering if this is a usual problem or maybe I need to look at the rest of my code. I have also read that strlen is not very reliable and mb_strlen is better (which also causes the same problem with my code).

    Is there a better option? Thanks for your time.
    Im pretty new to web design but I am learning fast. I will help if I can.
    Check out my sites http://www.mediareviewzone.com http://www.iamrobsmith.com

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    What data type are you using for the field with the text?
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Member John Mc Grath's Avatar
    Join Date
    Sep 2011
    Location
    Ireland
    Posts
    80
    Member #
    29172
    Liked
    3 times
    I did a bit of research and my problem is that the number is too large for strlen because of the way it is encoded. I have found a alternative that is probably better for my site which is str_word_count. Just in case anyone else might have the same problem which they probably won't because this is a very beginners problem
    Im pretty new to web design but I am learning fast. I will help if I can.
    Check out my sites http://www.mediareviewzone.com http://www.iamrobsmith.com


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:09 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com