Jump to content


Photo

Having a little trouble


  • Please log in to reply
2 replies to this topic

#1 nixy

nixy
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 August 2006 - 09:58 PM

Alright a little background - I'm pretty new to PHP but I know how to follow the lines and can understand it relatively well. My problem is writing it. What I am trying to create is an automated bank (i.e it uses variables put into the form to select which table into which the transaction will be added and another variable to select which table from which the transaction will be subtracted. Anyways, first off I'd like to know if I'm going in the right direction (I'm pretty sure I am, but if I'm not it explains a ton XD)

and second off I'd like a little help with the code.

I picked up a code from Jpmaster77 on registering and logging in and it's a bit complicated for me and I can follow it vaguely enough though. I'd like for a table with the chosen username to be created when the person registers, however I keep getting the error Parse error: parse error, unexpected T_VARIABLE in /home/paleysa/public_html/vscb/Blah/database.php on line 159 coming up  ::) and I don't know what to do.

I've linked my files as text files so that the code can be viewed. Everything except the function addNewTable in database.txt was written by Jpmaster77. I'd want to enter $database->addNewTable($subuser) on to line 321 (session.php) after if($database->addNewUser($subuser, md5($subpass), $subemail)) but once again I don't know how to do that either.
http://pale-sake.com...lah/session.txt
http://pale-sake.com...lah/process.txt
http://pale-sake.com...h/constants.txt
http://pale-sake.com...ah/database.txt

If I come off as too new to help and it's a really simple answer and no one feels like wasting their time helping me with something so simple - then maybe a nice link to point me in the right direction?

Thanks!
Nixy 

#2 sasa

sasa
  • Staff Alumni
  • Advanced Member
  • 2,804 posts
  • LocationHrvatska

Posted 14 August 2006 - 10:20 PM

function addNewTable($username){
      $q = "CREATE TABLE IF NOT EXISTS ".$username."('to' varchar(30) not null, 'from' varchar(30) not null, 'amount' int not null, 'date' date not null primary key, 'for' varchar(250))";
      return mysql_query($q, $this->connection);
  }

#3 nixy

nixy
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 August 2006 - 11:07 PM

^_^ oh wow that was simple - thanks sasa!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users