Thread: SQLite
View Single Post
  #49  
Old 04-15-2009, 07:02 AM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by devilsknite1 View Post
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)
{
  
findPlayerplayer.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.rowtemp.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.
Reply With Quote