Can you do this query/is there a better way of doing it?
#1

pawn Код:
format(query, sizeof(query), "SELECT `CSlot1`, `CSlot2`, `CSlot3`, `FSlot` FROM `accounts` WHERE id = %d, id = %d, id = %d, id =%d", AccID[playerid][0], AccID[playerid][1], AccID[playerid][2], AccID[playerid][3]);
    mysql_tquery(dbHandle, query, "GetMASlot", "si",intext, playerid);
Reply
#2

i don't know what is your main purpose but it won't work with comma use an " AND "...
Код:
WHERE id=%d AND id=%d
Reply
#3

Adding a number to a column name is almost never a good idea. It usually signals poor database design.

If you want to select rows based on values in a list then you should the IN operator, e.g.
PHP код:
SELECT FROM table WHERE id IN(1357
Or even
PHP код:
SELECT FROM table WHERE someId IN(SELECT id FROM anotherTable WHERE foo bar
Reply
#4

I don't really see how that can be the case could you explain? I use it for more efficient data retrieval, i.e

pawn Код:
format(string, sizeof(string), "CSlot%d", slot);
Never heard of the IN operator, thank you very much.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)