Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Another PHP Problem  (Read 777 times)

0 Members and 1 Guest are viewing this topic.

PoeFacedKilla

Prussian Killer Bee
Another PHP Problem
« on: May 15, 2007, 01:05:49 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 269
I am building a members db, and when i try to add a user, it doesn't insert it into the db:
Code: [Select]
<? include $_SERVER['DOCUMENT_ROOT']."/black_site/layout /top.php"; ?>
<?
$nr = $_GET['nr'];
if($nr=='') {
?>
<form action="/black_site/register.php?nr=0" method="post">
Username: <input type="text" name="user"><br />
Password: <input type="password" name="pass"><br />
Email: <input type="text" name="email"><br />
<input type="submit" value="Go!">
</form>
<?
} else if($nr=='0') {
$user = $_POST['user'];
$pass = $_POST['pass'];
$email = $_POST['email'];
$result = mysql_query("SELECT (username) FROM users WHERE username='$user'");
if(mysql_num_rows($result)==1) {
print "Username is Taken";
} else {
mysql_query("INSERT INTO `users` (`username`,`password`,`email`,`class`) VALUES ('$user','$pass','$email','member')");
mysql_query("INSET INTO `user_pro` (`name`,`msn`,`yaim`,`icq`,`site`,`site_link`
,`date_born`,`age`,`class`,`position`) VALUES ('$user','N/A','N/A','N/A','N/A','N/A','N/A',
'N/A','Member','N/A')");
print "You Have Been Registered";
}
}
?>
<? include $_SERVER['DOCUMENT_ROOT']."/black_site/layout /bottum.php"; ?>
Logged
the Indyboard - User Generated Social Forum | Now With Even More Discussion!
Poe, The Independent Programmer
  • Zelda Shrine

Lady Krisiries

Re: Another PHP Problem
« Reply #1 on: May 15, 2007, 04:17:40 pm »
first off, you shouldn't have the $user, $pass, and $email as they are, they should be more like {$user}, {$pass}, and {$email}. And it wouldn't hurt to verify that your MySQL query isn't getting an error, too. If that doesn't work, I'm not paying enough attention to your coding, I'm working on college work and somewhat busy
Logged

PoeFacedKilla

Prussian Killer Bee
Re: Another PHP Problem
« Reply #2 on: May 15, 2007, 10:44:55 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 269
its all ok, i was just brain dead there for about an hour, but i've figured all this out.
Logged
the Indyboard - User Generated Social Forum | Now With Even More Discussion!
Poe, The Independent Programmer
  • Zelda Shrine
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.059 seconds with 43 queries.

anything