Help with MySQL - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with MySQL (
/showthread.php?tid=263089)
Help with MySQL -
[IL]HeHu - 20.06.2011
I am using the a_sampmysql and I am completely new to it.
Now I have this:
PHP код:
public MySQLFetchFactionRecord(sqlfactionid, sqlresult[]) // by Luk0r
{
new query[128];
format(query, sizeof(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?
Re: Help with MySQL -
Alvord - 20.06.2011
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.
Re: Help with MySQL -
[IL]HeHu - 20.06.2011
Thanks, just an off topic question.
When I want to define a hex variable, is it %h?
Re: Help with MySQL -
Alvord - 20.06.2011
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)
Re: Help with MySQL -
[IL]HeHu - 20.06.2011
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?
Re: Help with MySQL -
[IL]HeHu - 21.06.2011
Help please?