Jump to content


Photo

How do I insert their username into the database?


  • Please log in to reply
2 replies to this topic

#1 Pi_Mastuh

Pi_Mastuh
  • Members
  • PipPipPip
  • Advanced Member
  • 233 posts
  • LocationMN

Posted 26 August 2006 - 09:01 PM

I need to make it so that when they hit the submit button the user's name is stored in the database. How do I do that?
Schroedinger's Cat walks into a bar.
And doesn't.

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 26 August 2006 - 09:08 PM

if ($_POST['submit']) {
$username=mysql_real_escape_string($_POST['username']);
$query=mysql_query("INSERT INTO table_name (ID, username) VALUES('','$username')");
}

thats a simple way but can be lots more advanced
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 whare

whare
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 26 August 2006 - 09:10 PM

i say this alot on here but this helped me loads so have a look at this....

http://www.phpfreaks...orials/40/0.php

it will help you adding things to a db accessing them again and creating sessions ect ect.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users