scheols Posted June 24, 2006 Share Posted June 24, 2006 heres my database filedb.php[code]<?php$user = $_POST["username"];$pass = $_POST["password"];$pass2 = $_POST["password2"];$email = $_POST["email"];$email2 = $_POST["email2"];//Get The Database$db_connection = mysql_connect("localhost", $_POST["dbuname"], $_POST[ "dbpass"]);/*--------------------------------------------------------------------------------------------------*///Choose database or return error@mysql_select_db($_POST["dbname"]) or die( "unable to select database");/*--------------------------------------------------------------------------------------------------*/$check = mysql_query("select user name from users where username=\"$user\"");/*--------------------------------------------------------------------------------------------------*/$returned = mysql_fetch_array($check);/*--------------------------------------------------------------------------------------------------*/if(!empty($returned)) { header("Location: someerrorpage.php"); mysql_close($link); Die();}else$pass=md5($pass);$request = "INSERT INTO buser values(NULL,"$user","$pass","pass2","email","email2")";/*--------------------------------------------------------------------------------------------------*/$results = mysql_query($request);/*--------------------------------------------------------------------------------------------------*/if($results) { header("Location: thxforj.php");}else { header("Location: errorjoin.php");}mysql_close($link);Die();}?>[/code]said i got a:Parse error: syntax error, unexpected T_VARIABLE in /home/scheols/public_html/db.php on line 36heres my form :[code]<HTML><BODY><form action="db.php"method="post">DataBase Name:<input type="text" name="dbname"><br>User Name: <input type="text" name="dbuname"><br>DB User Password:<input type="text" name="dbpass"><br><input type="submit" value="Register" name="submit"></form></BODY></HTML>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12820-error-what-i-do-wrong/ Share on other sites More sharing options...
Koobi Posted June 24, 2006 Share Posted June 24, 2006 it's funny..T_VARIABLE is to do with variable names...but to me it seems like you're missing a brace...because your else (before the $pass=md5($pass);) lacks an opening brace but at the end of the PHP you have a closing brace.and it would be best if you told us what line 36 was...especially because i'm not really into the whole counting thing :) Quote Link to comment https://forums.phpfreaks.com/topic/12820-error-what-i-do-wrong/#findComment-49157 Share on other sites More sharing options...
scheols Posted June 24, 2006 Author Share Posted June 24, 2006 line 36 is[code]$request = "INSERT INTO buser values(NULL,"$user","$pass","pass2","email","email2")";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12820-error-what-i-do-wrong/#findComment-49160 Share on other sites More sharing options...
Koobi Posted June 24, 2006 Share Posted June 24, 2006 that would be because you use double quotes as delimiters (at the beginning and end of the SQL to tell PHP that those are the bounds of the SQL) and you use double quotes within the query as well and PHP gets confused as to which is what since it's only a program that follows coded instructions.you have two options, i prefer the latter:[code]$request = "INSERT INTO buser values(NULL,\"$user\",\"$pass\",\"pass2\",\"email\",\"email2\")";[/code][code]$request = "INSERT INTO buser values(NULL,'$user','$pass','pass2','email','email2')";[/code]why do i prefer the latter? because it's easier to read and is probably fractionally faster than the former.hope that helped :):edit:also, don't forget the missing brace i mentioned in my previous post :) Quote Link to comment https://forums.phpfreaks.com/topic/12820-error-what-i-do-wrong/#findComment-49163 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.