Mysql Simple question[+1Rep]
#1

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 ?
Reply
#2

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

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

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

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

What version MySQL are you using ?
Reply
#7

Im using R33
wiki.sa-mp.com/wiki/MySQL/R33
Reply
#8

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 *
Reply
#9

how select table?
Reply
#10

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)