devang23 Posted December 5, 2009 Share Posted December 5, 2009 im trying to figure this out, but the error message keeps shooting out at me and sayin theres a T variable error in line 24, this is a script i followed, and im trying to send information back to a database <html><head><title>Adding a User </title></head> <body> <?php if( (!$firstname) or (!$lastname) or (!$username) or (!$password) ) { $form ="Please enter all new user details"; $form.="<form action=\"$PHP_SELF\""; $form.=" method=\"post\">First Name: "; $form.="<input type=\"text\" name=\firstname\""; $form.=" value=\"$firstname\"><br>Last Name: "; $form.="<input type=\"text\" name=\"lastname\""; $form.=" value=\"$lastname\"><br>UserName: "; $form.="<input type=\"text\" name=\"username\""; $form.=" value=\"$username\"><br>PassWord: "; $form.="<input type=\"text\" name=\"password\""; $form.=" value=\"$password\"><br>"; $form.="<input type=\"submit\" value=\"Submit\">"; $form.="</form>"; echo($form); } else { $conn = mysql_connect("mysql4.000webhost.com") or die("Try Again Punk"); $db = mysql_select_db("a3213677_snorre",$conn) or die("NOOPE") $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\$password\") )"; $result = ($sql,$conn) or die ("NOT EVEN") if($result) { echo("New User $username ADDED DUH!") ; } } ?> </body></html> Link to comment https://forums.phpfreaks.com/topic/184057-still-having-the-most-troublehelp/ Share on other sites More sharing options...
corbin Posted December 5, 2009 Share Posted December 5, 2009 $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\$password\") )"; Should be $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\"$password\") )"; And really, you could use single quotes so it looks cleaner: "INSERT INTO table VALUES ('{$val1}');" Link to comment https://forums.phpfreaks.com/topic/184057-still-having-the-most-troublehelp/#findComment-971742 Share on other sites More sharing options...
devang23 Posted December 5, 2009 Author Share Posted December 5, 2009 $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\$password\") )"; Should be $sql = "insert into User Table(first_name,last_name,user_name,password) values(\"$firstname\",\"$lastname\",\"$username\",password(\"$password\") )"; And really, you could use single quotes so it looks cleaner: "INSERT INTO table VALUES ('{$val1}');" hang on, im a little new at this so i didnt quite understand that....I added the " before the password part but its still sending me back the same error message on line 24..... and where do i put "INSERT INTO table VALUES ('{$val1}');" Link to comment https://forums.phpfreaks.com/topic/184057-still-having-the-most-troublehelp/#findComment-971747 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.