Raised This Month: $ Target: $400
 0% 

MySQL if problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stulle
New Member
Join Date: Jan 2010
Old 01-26-2010 , 15:36   MySQL if problem
Reply With Quote #1

Hi, i like to check if a player ist already at the MySQL database when hes connecting.

At the server_print i can see that all is fine (shows the same id's), but at the if loop it dosen't work.

PHP Code:
public client_connect(id)
{
    new 
Sql:mysql dbi_connect(MYSQL_DATA[0], MYSQL_DATA[1], MYSQL_DATA[2], MYSQL_DATA[3])

    new 
connect_steamid[35]
    
get_user_authid(id,connect_steamid,35)

    new 
steam_check dbi_query(mysql"SELECT steamid FROM stats WHERE steamid = '%s'"connect_steamid)
    
server_print("%s - %s"steam_checkconnect_steamid)
    if(
connect_steamid[0] == steam_check) {
        
server_print("ID vorhanden %s",connect_steamid[0])
    }

Stulle is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 01-26-2010 , 15:53   Re: MySQL if problem
Reply With Quote #2

It would be much better to use client_authorized( ) since that is when the client's SteamID is authorized with the server.

Code:
public client_authorized(id) {     new Sql:mysql = dbi_connect(MYSQL_DATA[0], MYSQL_DATA[1], MYSQL_DATA[2], MYSQL_DATA[3])     new connect_steamid[35]     get_user_authid(id,connect_steamid,35)     new rows, Result:ret = dbi_query2(mysql, rows, "SELECT steamid FROM stats WHERE steamid = '%s'", connect_steamid)     if(rows > 0) {         // exists     }         dbi_free_result(ret)         dbi_close(mysql) }

Also, read up on how the functions work and what you can do:
http://www.amxmodx.org/funcwiki.php?go=module&id=5
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!

Last edited by Exolent[jNr]; 01-26-2010 at 15:55.
Exolent[jNr] is offline
Stulle
New Member
Join Date: Jan 2010
Old 01-26-2010 , 16:11   Re: MySQL if problem
Reply With Quote #3

ah ok, thanks that works fine
Stulle is offline
Reply



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 07:21.


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