Jump to content

Still having the most trouble,...help?


devang23

Recommended Posts

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
Share on other sites

$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
Share on other sites

$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.