| 
			
			 
			
				04-15-2009, 07:02 AM
			
			
			
		 | 
	| 
		
			| jwd |  |  |  
			| 
					Join Date: Oct 2005 Location: Greater Manchester 
						Posts: 2,423
					 |  | | 
	Quote: 
	
		| 
					Originally Posted by devilsknite1  Would using this in an onPlayerLogin() still work? I tried Stefan's sample age code thing, and I get the working output, but if i try to edit it the slightest bit and use findPlayer( p.account ); (p is a param in the onPlayerLogin() function) I get this: NPC Code:
 Accounts in database: 0 
 
Here's what I'm using:
 
	PHP Code: 
		
			
function onPlayerLogin( p )
{
 p = findPlayer( player.account );
 requestsql("CREATE TABLE IF NOT EXISTS test (account varchar not null default '' primary key, id int not null default 1)", false);
 requestsql("INSERT INTO test VALUES (" @ p.account @ "," @ p.id @ ")", false);
 temp.req = requestsql("SELECT * FROM test", true);
 if (!temp.req.completed)
 waitfor(temp.req,"onReceiveData",60);
 echo("Accounts in database: " @ temp.req.rows.size());
 for (temp.row: temp.req.rows)
 echo("  Account: " @ temp.row.account @ ", ID: " @ temp.row.id);
 }
 
 Like I said, editing the code SLIGHTLY just gives me an output of 0. I didn't go through the whole SQLite language either, which I plan on doing later tomorrow. |  If you log on Dev Astrid, you can view my testing NPC. I managed to get it working, eventually, haha. | 
 
			
			
			
			
				  | 
|  |