| misterb | 2006-07-05 18:16:00 |
![]() Posts: 25 Topics participated: 15 Topics started: 8 First post: 2006-03-04 10:39:00 Last post: 2006-10-04 09:06:00 |
There's a bad query in loop in the inbox.php which means that if you have 20 pms, then you'll get 20+ queries each time you check your inbox. I suggest to remove this query by storing sender's and receiver's usernames in the 'messages' table. Here's how it could be done: Modify your 'messages' table: ALTER TABLE `messages` ADD `sender_username` VARCHAR( 250 ) DEFAULT 'System' NOT NULL; ALTER TABLE `messages` ADD `receiver_username` VARCHAR( 250 ) NOT NULL; Open inbox.php find and comment these 2 lines $res2 = mysql_query("SELECT username FROM users WHERE id=" . $arr["receiver"]) or sqlerr(); $arr2 = mysql_fetch_assoc($res2); find $receiver = "" . $arr2["username"] . ""; replace with $receiver = "" . $arr["receiver_username"] . ""; find and comment $res2 = mysql_query("SELECT username FROM users WHERE id=" . $arr["sender"]) or sqlerr(); $arr2 = mysql_fetch_assoc($res2); find replace with Open takemessage.php find $query = "INSERT INTO messages (sender, receiver, added, msg, poster) ". |
![]() |
Optimize Inbox
| DRRRR | 2006-07-05 18:36:00 |
![]() Posts: 510 Topics participated: 277 Topics started: 5 First post: 2006-03-13 22:18:00 Last post: 2006-10-25 20:54:00 |
Why not just use a JOIN in that select? |
![]() |
| Furungia | 2006-07-05 18:38:00 |
![]() Posts: 20 Topics participated: 10 Topics started: 2 First post: 2006-07-05 18:38:00 Last post: 2007-01-02 07:46:00 |
If I understand that code correctly doesn't using this mod mean that that all old messages will show wrong? And if it does then before using this you should update messages table up to date by putting all the correct usernames to all rows... |
![]() |
| misterb | 2006-07-05 19:16:00 |
![]() Posts: 25 Topics participated: 15 Topics started: 8 First post: 2006-03-04 10:39:00 Last post: 2006-10-04 09:06:00 |
Why not just use a JOIN in that select? And what about user named System who sends all notifications and stuff? If I understand that code correctly doesn't using this mod mean that that all old messages will show wrong? And if it does then before using this you should update messages table up to date by putting all the correct usernames to all rows... You're right, but i think pms are not so valuable, so you can just do "delete from messages" query |
![]() |
| DRRRR | 2006-07-05 19:21:00 |
![]() Posts: 510 Topics participated: 277 Topics started: 5 First post: 2006-03-13 22:18:00 Last post: 2006-10-25 20:54:00 |
And what about user named System who sends all notifications and stuff? Those would return a NULL value, and you can catch that NULL either still in your query or ue PHP for it ;) |
![]() |
| misterb | 2006-07-05 19:28:00 |
![]() Posts: 25 Topics participated: 15 Topics started: 8 First post: 2006-03-04 10:39:00 Last post: 2006-10-04 09:06:00 |
Well, that's cause i didn't know it... Then why it's not done by default? |
![]() |
| DRRRR | 2006-07-05 19:32:00 |
![]() Posts: 510 Topics participated: 277 Topics started: 5 First post: 2006-03-13 22:18:00 Last post: 2006-10-25 20:54:00 |
Then why it's not done by default? MMysql 3.x compatibility maybe, don't know how old that code is |
![]() |
| misterb | 2006-07-05 19:34:00 |
![]() Posts: 25 Topics participated: 15 Topics started: 8 First post: 2006-03-04 10:39:00 Last post: 2006-10-04 09:06:00 |
Will you be so kind and post your way of optimizing? |
![]() |
| DRRRR | 2006-07-05 19:44:00 |
![]() Posts: 510 Topics participated: 277 Topics started: 5 First post: 2006-03-13 22:18:00 Last post: 2006-10-25 20:54:00 |
SELECT |
![]() |
| Retro | 2006-07-07 04:17:00 |
![]() Posts: 461 Topics participated: 232 Topics started: 10 First post: 2006-03-21 13:50:00 Last post: 2008-12-23 18:24:00 |
I would prefer the query to return a NULL to the script, then it can do what it wants with the NULL, such as create 'system' that doesn't hyperlink, of a 'system' that hyperlinks to a staff PM system. |
![]() |
Similar threads
| Topic | Posts | Last post |
|---|---|---|
| help optimize | 7 | 2008-04-03 21:50:00 |
| New INBOX modification | 37 | 2008-07-28 13:57:00 |
| problem with inbox | 2 | 2007-11-04 13:44:00 |
| New nicer inbox | 26 | 2008-07-08 21:28:00 |
| inbox.php | 3 | 2007-10-28 04:05:00 |
Statistics
| Today's active topics · | |
|---|---|
| User(s) active in the past 30 minutes | |
| 59 Guests, 9 Members LiquidAtoR, rocky, mesh, GunnersBr, RayDaX, DeMaper, Txie, abcd*, bbrian017 spis , śmieszne mp3 , mp3 download , pozycjonowanie strony , okna drewniane alveo Avatary Kredyty hipoteczne na firmę Kredyt Wierszyki | |
| Often viewed topics | |
| · Preliminary XSS... · RSS feed passke... · Invite With Bonus · Browse.php · new Message · Torrent Inline ... · torrent uppload... · Save PMs to temp! · Similar torrent... · Work with mod_r... · Nice signup usi... · Stats on index · browse.php · action script · hash fails???:S · Ratio Master · User/ID · Warned users (o... · Question about ... · Rating using ajax | |
| Forthcoming Calendar Events within the next 5 days | |
| There are no forthcoming calendar events | |




