Not Inserting into database

Started by Debian, Sep 14, 2015, 04:37 AM

Previous topic - Next topic

EK.IceFlake

Use this query checker (pass on the value usually q returned by da query)
function ValidateQuery(q)
{
    if (typeof q == "bool") return 0;
    return 1;
}
If it return 0 the query fail, try fixing it or copying it on a better editor like SQLiteBrowser instead of VCMP default. It will tell ya da friggin error
If return 1 the query good but idk why it doesn't work.

KAKAN

is there any function named 'typeof' really exists in VCMP?
oh no

DizzasTeR

Quote from: KAKAN on Sep 15, 2015, 05:28 AMis there any function named 'typeof' really exists in VCMP?

Seems like you haven't read the squirrel manual yet which Thijn provided you.

KAKAN

Not completed, I left the hard points, just read the basics as I didn't have much time when Thijn gave me that link
oh no

Kratos_


Quote from: Debian on Sep 15, 2015, 02:07 AMIm trying to test and in this code Accounts and Acc are working fine even Dstats is inserting and updating but not loading column data and each time a player joins dstats will start from 0. acc working fine. 

Note that if(a) not only checks whether a exists but rather those values will also get eliminated which are conventionally false .
A small test in support of this statement :-


local array = [

"123",
null,
"abc",
911,
true,
0.0,
0x28,
3.14,
false,
1,
0

];

foreach( index, values in array )
{
if( values ) print( "position : " + (index+1) );
}



While attempting to retrieve values from the database , you written up this condition :-
Quote from: Debian on Sep 15, 2015, 02:07 AM// Extracted from the body of constructor of class DebianStats
if( ::GetSQLColumnData( query, 2 ) ){


During registration , you're inserting value 0 to 3rd column so that condition will not be satisfied since 0 is conventionally false . Above test could be considered as an experimental evidence for this fact .

Condition should be :-
if ( ::GetSQLColumnData( query, 2 )  != null )

if(a) & if(a != null) are two different variants , where former one does the job of later one plus it also takes care of boolean
entities .
In the middle of chaos , lies opportunity.