Help with MySQL
#1

I am using the a_sampmysql and I am completely new to it.
Now I have this:
PHP код:
public MySQLFetchFactionRecord(sqlfactionidsqlresult[]) // by Luk0r
{
    new 
query[128];
    
format(querysizeof(query), "SELECT * FROM `factions` WHERE `factionid` = '%d' LIMIT 1"sqlfactionid);
    
samp_mysql_query(query);
    
samp_mysql_store_result();
    if(
samp_mysql_fetch_row(sqlresult)==1)
    {
        
samp_mysql_free_result();
        return 
1;
    }
    return 
0;

I understood from this that it will take from table factions where the faction id is equal to faction id mentioned in the public.
But what I don't understand is, what's the sqlresult?
Reply
#2

On the code you've posted, it's checking if the row exists.

Код:
if(samp_mysql_fetch_row(sqlresult)==1)
    {
        samp_mysql_free_result();
        return 1;
    }
The code above means that after the query has been executed and stored, it would check if there's 1 row with the requirements met exists in the database.
Reply
#3

Thanks, just an off topic question.
When I want to define a hex variable, is it %h?
Reply
#4

Quote:
Originally Posted by [IL]HeHu
Посмотреть сообщение
Thanks, just an off topic question.
When I want to define a hex variable, is it %h?
Yup, as far as I know. (120 seconds between posts, xD)
Reply
#5

Back on topic, and thanks!
Ugh, I got this problem, that it says the server can't find my script, the Factions.amx but it's located inside my gamemodes folder.
I am suspecting it's because it can't log into the MySQL database, where do I put the .sql file?
Reply
#6

Help please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)