SA-MP Forums Archive
If SQL exists.? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: If SQL exists.? (/showthread.php?tid=155832)



If SQL exists.? - Antonio [G-RP] - 19.06.2010

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

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


Re: If SQL exists.? - DowNlOaD_ - 19.06.2010

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


Re: If SQL exists.? - Antonio [G-RP] - 19.06.2010

How do I get the number of records?

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


Re: If SQL exists.? - park4bmx - 19.06.2010

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



Re: If SQL exists.? - oliverrud - 19.06.2010

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
        }



Re: If SQL exists.? - Antonio [G-RP] - 19.06.2010

Thanks mate


Re: If SQL exists.? - oliverrud - 19.06.2010

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.