clowes
08-02-2009, 10:09 PM
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.
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.