Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
registration page code
Old 07-17-2005, 01:20 PM registration page code
Junior Talker

Posts: 1
Trades: 0
PHP Code:
 <?php
 
// set your infomation.
 
$dbhost='localhost';
 
$dbusername='elsport';
 
$dbuserpass='c4daa19';
 
$dbname='elsport_users';
 
// connect to the mysql database server.
 
mysql_connect ($dbhost$dbusername$dbuserpass);
 
mysql_select_db($dbname) or die("Cannot select database");
 
 
//Are they just getting here or submitting their info?
 
if (isset($_POST["username"])) {
 
$username $_POST["username"];
 
$password $_POST["password"];
 
$cpassword $_POST["cpassword"];
 
$email $_POST["email"];
 
//Was a field left blank?
 
if($username==NULL|$password==NULL|$cpassword==NULL|$email==NULL) {
 echo 
"A field was left blank.";
 }else{
 
//Do the passwords match?
 
if($password!=$cpassword) {
 echo 
"Passwords do not match";
 }else{
 
//Has the username or email been used?
 
$checkuser mysql_query("SELECT username FROM users WHERE username='$username'");
 
$username_exist mysql_num_rows($checkuser);
 
 
$checkemail mysql_query("SELECT email FROM users WHERE email='$email'");
 
$email_exist mysql_num_rows($checkemail);
 
 if(
$email_exist>0|$username_exist>0) {
 echo 
"The username or email is already in use";
 }else{
 
//Everything seems good, lets insert.
 
$query "INSERT INTO users (username, password, email) VALUES('$username','$password','$email')";
 
mysql_query($query) or die(mysql_error());
 echo 
"The user $username has been successfully registered.");
 
?>



that is my code for the registration page, but on the page this part shows up in text above the form 0|$username_exist>0) { echo "The username or email is already in use"; }else{ //Everything seems good, lets insert. $query = "INSERT INTO users (username, password, email) VALUES('$username','$password','$email')"; mysql_query($query) or die(mysql_error()); echo "The user $username has been successfully registered."); ?>



could someone help?

Last edited by 0beron; 07-17-2005 at 02:27 PM..
spink is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-17-2005, 02:34 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
I don't think your server is set up with php. Either that or you haven't named the file with a .php extension. The browser sees the <?php at the start and the > just before the 0 as the beginning and end of a big html tag.
You need to have php installed correctly and the file named with .php extension (or your server set up to parse html files as php).

Also (this isn't your problem) but you use | for logical or when you should use || instead. Logical or is for boolean values of true and false, eg true || false == true. | is bitwise or for numbers eg Binary 10001 | 01100 == 11101
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to registration page code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.49791 seconds with 12 queries