PHP Newsletter

Join now and receive weekly updates pertianing to the world of PHP.

Polls

What do you think about the new PHPMine Design?
Awesome
Not Bad
Sucks

PHP Gigs By City

PHP Jobs By Topic

Advertisements

why php login not working with my web page (website)?

Asked 2010-03-12 04:45:03 by Bharat Rasayan F

i am in the process of developing my webpage for this i write the code for registration of user (registration.htm) and for validation and insert (register.php) .
I use the database arjun_kaa_database, table user for storing data.
I am using WAMP.
when i run the program through localhost of WAMP it work perfactly ok.
I mean to say from the same machine where wamp is installed.

But when i run my site www.apysan.50webs it gives me unpredictable result,
in fact it does not display any error but simple show the code of register.php on browser.

This is for the first time i am doing this kind of project , perhaps i miss something.
May be it required to upload your database too in the host apysan.50webs.com

I am using ftp to upload my all files html or picture.
i kept the file index.html at the root which is my main page.

Kindly help me to achieve my goal. so that any body can enter and login his deatil in my site.

Please help

my register.php
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("arjun_kaa_database", $con);



// lets check to see if the username already exists

$checkuser = mysql_query("SELECT username FROM users WHERE username='$_POST[username]'");

$username_exist = mysql_num_rows($checkuser);

if($username_exist > 0){
echo "I'm sorry but the username you specified has already been taken. Please pick another one.";
unset($username);
//include 'registration.htm';
exit();
}

$sql="INSERT INTO users (name, email, username, password)
VALUES('$_POST[name]', '$_POST[email]', '$_POST[username]', '$_POST[password]')";


//echo "You have successfully Registered";


if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
//echo "1 record added";
echo "You have successfully Registered";

mysql_close($con)
?>

Anwered 2010-03-13 20:25:16 by Vy

Sorry if my answer is all wrong. Ive only been learnin php for a few day.

Are you sure php is enabled on the server? also i don't know why you put the "//" before your echo codes. Doesnt the "//" prevent the code from running.

Sorry im probably not much help.

Questions and answers provided by the Yahoo Answers Community.