SA-MP Forums Archive
Mysql Simple question[+1Rep] - 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: Mysql Simple question[+1Rep] (/showthread.php?tid=521434)



Mysql Simple question - leo9 - 23.06.2014

I wanna make a script with shows the shop owner from sql now i have the first shop
Код:
new shop1name[128];
i wanna to get the shop1name text from table shops from row 1 and column called name Like this:
|------
|Column|Type|Null|Default
|------
|id|owner|name|money|sellprice
|1 |guest|Pizza |32137|23123

How get the "pizza" and put it in shop1name ?


Re: Mysql Simple question[+1Rep] - RenovanZ - 23.06.2014

pawn Код:
mysql_query("SELECT `name` FROM `dbname` WHERE `id` = 1");



Re: Mysql Simple question[+1Rep] - leo9 - 23.06.2014

it automaticaly select the table and how to put it in shop1name?


Re: Mysql Simple question[+1Rep] - Faisal_khan - 23.06.2014

Use cache_get_content.
pawn Код:
shop1name = cache_get_content(params);
Search the wiki for the params. Currently from mobile so I cannot show that.


Re: Mysql Simple question[+1Rep] - leo9 - 23.06.2014

Can someone make example for me pls i cant it dont show in 3dlabeltext


Re: Mysql Simple question[+1Rep] - RenovanZ - 23.06.2014

What version MySQL are you using ?


Re: Mysql Simple question[+1Rep] - leo9 - 23.06.2014

Im using R33
wiki.sa-mp.com/wiki/MySQL/R33


Re: Mysql Simple question[+1Rep] - RenovanZ - 23.06.2014

Use cache_get_row.
pawn Код:
cache_get_row(rownumber, fieldnumber, shop1name);
In your case its row number 0 and field 2
* Rows and Fields number begins from 0 *


Re: Mysql Simple question[+1Rep] - leo9 - 23.06.2014

how select table?


Re: Mysql Simple question[+1Rep] - RenovanZ - 23.06.2014

You dont need to select the table, just:
pawn Код:
new shop1name[128];
cache_get_row(rownumber, fieldnumber, shop1name);
new string[50];
format(string, sizeof(string), "Shop ID 1 Name: %s", shop1name);
SendClientMessage(playerid, -1, string);