Raised This Month: $ Target: $400
 0% 

[SOLVED] query not returning results!?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 03-22-2011 , 16:53   Re: query not returning results!?
Reply With Quote #3

1. Thanks for the tip. Will do. Though I don't know how that works

2. This was ok when I first wrote it, but after all the modifications I guess I changed it by mistake. Fixed it now:
new userID = SQL_ReadResult(Query, SQL_FieldNameToNum(Query, "autoID"))
formatex(cache, 511, "SELECT * FROM %s WHERE userID='%d';", g_sqlTable_privs, userID)

3. I can't do that, the password and username is in a different table than the one with the privs. Though maybe I might be able to do it with a more complex query by left joining the two tables, but I'm too lazy to think it up when this way works as well

4. Might do that.

5. Yes it should insert it properly. The admins table is created with the admin_sql plugin that comes with amxx. It has auth, password, access and flags fields (eg. user's name, user's pass, abcdefgh..., k)
The users table contains users from the website, I believe their fields are pretty self explainatory.
The users_privileges table contains the privileges that the users have purchased, with an autoID (primary key auto increment), userID which is the same as autoID from users table, priv id that tells which priv it is, autodate which is timestamp from the purchase moment, and period which is how many days is it purchased for. Hence in handle_priv func:
new final_moment = autodate + 86400*period //the timestamp(seconds since epoch launch) + days*seconds a day - gives the moment when the priv expires
if(get_systime() > final_moment) remove the priv from user_privileges
else add the priv in admins table, where it will be read from the game

EDIT: after fixing 2. the problem still exists, just as I thought.
after trying to add a and b flags, instead of getting "miromont, topsecret, ab, k" in the admins table, I get
"miromont, topsecret, b, k
miromont, topsecret, a, k"
So either the select query in the check_privs func doesn't return results, or the check for results in handle_check_privs thinks there are no results to update and goes to insert a new line. Or maybe there is even greater problem, dunno. Either way, I can't find the reason for this problem...
__________________

Last edited by SeriousSam; 03-22-2011 at 17:29.
SeriousSam is offline
Send a message via Skype™ to SeriousSam
 



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 14:29.


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