if field exist sqllite
#1

hai hai

how to check if filed is exist?
this my data
Код:
databasename : info.db
tablename : player
field : email
how to check field if(fieldexist) ?

example
Код:
if (strval(inputtext) == fieldexist)
Reply
#2

Do you create fields/columns dynamically ?

If no, then there is no need for checks since you make the SQL table only once.

If yes, just perform a simple query including the field and check if there is result:
pawn Код:
new DBResult:result = db_query(info, "SELECT `email` FROM `player`;");
if (result)
{
    // field exist
}
db_free_result(result);
Reply
#3

im just create 1 table and 1 field , and not dynamic .

can im use like this
PHP код:
new DBResult:result db_query(info"SELECT `email` FROM `player`;");
if (
result == "test@ya.com")
{
    
// field exist
}
db_free_result(result); 
Reply
#4

Quote:
Originally Posted by ratxrat
Посмотреть сообщение
im just create 1 table and 1 field , and not dynamic .

can im use like this
PHP код:
new DBResult:result db_query(info"SELECT `email` FROM `player`;");
if (
result == "test@ya.com")
{
    
// field exist
}
db_free_result(result); 
That's not called checking for a field existence, i think you are checking for the email value for a specific user?
You can use the same query but with a little condition in it or maybe not (depends):
pawn Код:
db_query(db, "SELECT `email` FROM `player` WHERE `user` = 'test'");
So you can see i added a condition WHERE `user` = 'test' which actually filters that data.

For more, ****** for SQL(ite) learning to learn more deeply and clearly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)