Raised This Month: $ Target: $400
 0% 

Problem with Varchars


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Schwabba
Senior Member
Join Date: Apr 2008
Old 10-16-2010 , 09:30   Re: Problem with Varchars
Reply With Quote #3

Quote:
It would be strange if it worked. After all you are trying to store string in a single variable. Try this:
PHP Code:
        new count[32], count1[32], count2count3count4count5

        SQL_ReadResult
(Query,0count31)
        
SQL_ReadResult(Query,1count131)
        
count2 SQL_ReadResult(Query,2)
        
count3 SQL_ReadResult(Query,3)
        
count4 SQL_ReadResult(Query,4)
        
count5 SQL_ReadResult(Query,5
OMG, i coded the whole night, looks like i was to sleepy to use my brain.^^

Sometimes the simplest things took the most time...

Quote:
and remove that:

PHP Code:
        if(count == 0)
        
count 
Yep, forgot to delete it (used it on the rank system).

Quote:
About the 2nd problem:

PHP Code:
if(SQL_ReadResult(Query,0) || SQL_ReadResult(Query,0) == 0
will give you the same result as
PHP Code:
if(true
Both of them are wrong anyway. You should change it to:
PHP Code:
if(SQL_MoreResults(Query)) 
I know that, i just added the 2nd if, because it does'nt worked and i don't have to rewrite the 1st if later.

Quote:
Your way of creating toplist is very inefficient.
Why do you send 15 queries to mysql to get the toplist when you could get it with only 1 query?

I would code it this way:
1) Load toplist from mysql and store it in memory on plugin_init
2) Load player stats and store them in memory on client_authorized
3) Update toplist stored in memory when player gains points
4) Display toplist stored in memory when player wants to see toplist
5) Save player stats on client_disconnect
Then i have to make 15 queries on plugin_init? xD

I gotta sleep now (looks like i'm not able to code currently) xD

Last edited by Schwabba; 10-16-2010 at 09:35.
Schwabba is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode