If SQL exists.?
#1

How do I check if a thing exists in an SQL table?

Example, in my Vehicle_Prices field, seeing if the 'Model' 525 exists?
Reply
#2

you count the number of records

if it's 0 then it means that it doesn't exist

PS: if I misunderstood you then im sorry
Reply
#3

How do I get the number of records?

Example: Number of records of 'Model' = 525, in table Vehicle_Prices
Reply
#4

im not sure what u mean but do something like this this
pawn Код:
if(sql.................... != 0)
do what ever.
EXAMPLE
pawn Код:
if(sqlaccountstatus != 0)
Reply
#5

pawn Код:
format(stringsize, sizeof(stringsize), "SELECT * FROM `Vehicle_Prices` WHERE Model = '525'",owner);
        mysql_query(stringsize);
    mysql_store_result();
    if(mysql_num_rows() < 0)
        {
      SendClientMessage(playerid,COLOR_YELLOW,"Theres no model 525 ");
        }
        else
        {
            //There is 525
        }
Reply
#6

Thanks mate
Reply
#7

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Thanks mate
I think my code should work. Works for some of my stuff, well all that I use it for.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)