Results 1 to 5 of 5

Thread: 2 Problems. Special Chars & Loading Times

  1. #1
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default 2 Problems. Special Chars & Loading Times

    Ok.

    1) PHP/Mysql.
    - I have a database which contains the 'cards' which users own.
    - A user can have an infinite number of cards, but the most we are dealing with here is 1,000 say.
    - Basically when a user loads up his card page it shows a list of all his/her cards, and various graphical representations.

    One of these is 'How long the card has been owned'. I have a function which gets the bought date, and todays date and calculates how long each card has been owned for.

    At the end of the list, a graph is plotted of the number of cards owned for each timeframe.

    - In terms of php, we get the rows using mysql_query.
    We then use while(mysql_fetch_array()) to loop through all the records.
    For each record, the date difference is calculated.

    The problem I am having is that loading up 500, or even 1000 records is crashing my browser. Pagination seems like the perfect remedy BUT if i paginate by limiting each query to say 100 records, then the graphs are incorrect because they only show the ownership timeframes for those 100 records as opposed to all the records. Given that the 'length of time owned' changed daily.. it has to be calculated there and then... Any ideas how I can acomplish everything I want without crashing my browser?



    2) This has been bugging me for too long now. I dont understand or appreciate it, and I cant sort it out for the life of me. Help greatly appreciated.

    So I query a server, and collect some data. I display the data on my page.
    The following word:
    Code: [Select]
    Interdomain痴 is present. If I view source, it is displayed as
    Code: [Select]
    Interdomain’s
    I want to remove all words after this, so what I do is use strpos to find the position, and then use substr to stop at this point. Simple.

    If I strpos either Interdomain痴, or Interdomain’s I get nothing....
    If I strpos Interdomain, I get the right position... I.E These special chars are preventing me from getting what I want.


    Another example.
    The following is displayed:
    Code: [Select]
    覧覧覧覧覧覧覧覧覧覧覧覧
    On viewing source I see:
    Code: [Select]
    ————————————————————————

    In this case I simply want to delete these dashes, so I use str_replace(); Putting either of the above into str_replace does nothing....


    Ive tried utilizing strip_tags(); htmlspecialchars_decode(); etc to give just a plain text version... they do absolutely nothing.

    I am super confused.Help!



    I would great appreciate any help with both problems.

  2. #2
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Like in other posts, you need to provide code, we can try to help you from there.
    - Josh

  3. #3
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    I dont understand WHY I need to provide code, when these questions are simply PHP Theory... which applies to any code..

  4. #4
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Default

    Any ideas, or suggestions as to people/forums where I can find an answer.

  5. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by clowes
    I dont understand WHY I need to provide code, when these questions are simply PHP Theory... which applies to any code..
    Your questions sound more like you're trying to solve a problem with a particular project. They aren't theoretical; they're practical. There's a whole lot of theory, and usually only a very limited part applies to any particular problem.

    Like JShor said, you need to provide your code. This is because:

    1) If we don't know exactly what your problem is, we don't have any real chance of fixing it.

    2) If we don't know what you've written *so far*, we can't make a good suggestion about what to try next. Anything we "throw out" may simply confuse your code more.

    IF this isn't the answer you're looking for, your best bet is probably to hire a programmer to create a solution for you.

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
  •