SA-MP Forums Archive
How to - 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)
+--- Thread: How to (/showthread.php?tid=559229)



How to - Sime30 - 21.01.2015

Hi guys!

How to check if my business variable has a name( BizName) ?

I am checking wether bizname has something more than just a blank varchar (yes, I am using mysql) or else if it's empty blahblah...

Here I "grab" it from the database

pawn Код:
cache_get_field_content(i,"BizName",BizInfo[i][BizName],MySQLHandle,40);
And now when I am creating 3D text labels, I am checking if the name is something or it's default blank

pawn Код:
if(BizInfo[idbiz][BizName])
{

}
else
{

}
This isn't working, how can I make it work? Do I have to use strcmp?


Re: How to - Ironboy - 21.01.2015

Example code about sql part.
pawn Код:
mysql_format(mysql, query, sizeof(query), "SELECT `user` FROM `yourtable` WHERE `user` = '%e'", account); //you gotta change the table and column
new Cache:result = mysql_query(mysql, query);
if(cache_get_row_count() != 0)
{
    //If the rows found
}
else
{
        //if no rows exists
}
cache_delete(result);



Re: How to - Sime30 - 21.01.2015

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
Example code about sql part.
pawn Код:
mysql_format(mysql, query, sizeof(query), "SELECT `user` FROM `yourtable` WHERE `user` = '%e'", account); //you gotta change the table and column
new Cache:result = mysql_query(mysql, query);
if(cache_get_row_count() != 0)
{
    //If the rows found
}
else
{
        //if no rows exists
}
cache_delete(result);
You misunderstood me. My biz loading is ok, only checking if the variable bizname has something more than just a blank space isnt working


Re: How to - Sime30 - 22.01.2015

Small bump