Can someone help me out here, cant see my codes mistake...

A

Anonymous

Guest
<html>

<?php
$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];
$name = $HTTP_POST_VARS['name'];
$age = $HTTP_POST_VARS['age'];
$address = $HTTP_POST_VARS['address'];
$email = $HTTP_POST_VARS['email'];
$year = $HTTP_POST_VARS['year'];
$month = $HTTP_POST_VARS['month'];
$day = $HTTP_POST_VARS['day'];
$sex = $HTTP_POST_VARS['sex'];

if(!$username || !$password ||!$name || !$age || !$address || !$email || !$year || !$month || !$day || !$sex)
{
echo "Please enter correctly<br>";
exit;

}

$username = addslashes($username);
$password = addslashes($password);
$name = addslashes($name);
$age = addslashes($age);
$address = addslashes($address);
$email = addslashes($email);
$year = addslashes($year);
$month = addslashes($month);
$day = addslashes($day);


$date = $year."-".$month."-".$day;
@ $db = mysql_pconnect('localhost','','');

if(!$db)
{
echo 'Error, could not connect to database';
exit;


}


mysql_select_db('airpower');

$query = "select * from userdetail where username = '".$username."' ;

$result = mysql_query($query);
$num_results = mysql_num_rows($result);


if($num_results == 0)
{
$query2 = "insert into userdetail values('".$name."','".$age."','".$address."','".$sex."','".$email."','".$date."','".$username."','".$password."')";
}

else
{
echo "User already exist please enter another username<br>";

}



?>
 
post what err. you get...

if no output is obtained... do a [echo, exit] debug!
 
Back
Top