GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Oct-2005, 03:43
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

T_VARIABLE whats that???


hi i have just made a php script for a members only area and user login and register. In php with a mysql database but everytime i upload the page it comes up with Parse error: parse error, unexpected T_VARIABLE in /home/habglobe/public_html/newmember.php on line 12 this is the script i am useing

Code:
<html> <p>create a new user <?php $dbhost = "hab-globe.com"; $dbname = "userdetails"; $dbuser = "user"; $dbpass = "habbo250"; $username = $_POST['newusername']; $userpass = $POST_['newpassword']; $useremail = $_POST['email']; $today = date("y-m-d"); if ($username = "" $userpass = "" or $useremail = "") die ("<p>sorry you left a field empty please click the back butto to check your details") $query = "INSERT INTO user (username, password, joindate, email') VALUES ('$username', '$userpass', '$today', '$useremail')"; $connection mysql_connect(dbhost, $dbuser, $dbpass) or die ("<br>sorry couldnt connect to hab-globe.com"); $db = mysql_select_db($dbname, $dbconnection) or die("<br>sorry the hab-globe database is offline, please check back later!"); $result = mysql_query($query) or die ("sorry that user has been taken"); $_SESSION['login'] = 'yes'; ?> <p>thank you, your new user has been created. Please click <ahref="login.php"> here</a> to log into your hab-globe user account.<p> </html>
Last edited by JdS : 25-Oct-2005 at 06:23. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 25-Oct-2005, 06:29
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: T_VARIABLE whats that???


Hello djd@n,

There are errors on this line:

PHP Code:

if ($username = "" $userpass = "" or $useremail = ""){  //...} 



You should be comparing (==), not assigning (=)... and you missed including an or in there between the test expressions.

PHP Code:

if ($username == "" or $userpass == "" or $useremail == ""){} 



Also, notice the apostrophe inside this line?
INSERT INTO user (username, password, joindate, email')...
  #3  
Old 25-Oct-2005, 08:32
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

Re: T_VARIABLE whats that???


i have done all that but now it comes up eith the same but on line 14
  #4  
Old 25-Oct-2005, 08:38
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: T_VARIABLE whats that???


Please post the code you have now...
  #5  
Old 25-Oct-2005, 08:42
djd@n djd@n is offline
Awaiting Email Confirmation
 
Join Date: Oct 2005
Posts: 21
djd@n is on a distinguished road

Re: T_VARIABLE whats that???


PHP Code:

<html>
<p>create a new user
<?php
  $dbhost = "hab-globe.com";
  $dbname = "userdetails";
  $dbuser = "user";
  $dbpass = "habbo250";
  $username = $_POST['newusername'];
  $userpass = $POST_['newpassword'];
  $useremail = $_POST['email'];
  $today = date("y-m-d");
  if ($username == "" or $userpass == "" or $useremail == ""){} 
   die ("<p>sorry you left a field empty please click the back butto to check your details")
   $query = "INSERT INTO user (username, password, joindate, email) VALUES ('$username', '$userpass', '$today', '$useremail')";
  $connection  mysql_connect(dbhost, $dbuser, $dbpass)
   or die ("<br>sorry couldnt connect to hab-globe.com");
  $db = mysql_select_db($dbname, $dbconnection)
    or die("<br>sorry the hab-globe database is offline, please check back later!");
  $result = mysql_query($query)
   or die ("sorry that user has been taken");

$_SESSION['login'] = 'yes';
?>
<p>thank you, your new user has been created. Please click <ahref="login.php"> here</a> to log into your hab-globe user account.<p>
</html> 

 
 

Recent GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 08:38.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.