mysql_query ("INSERT INTO $tbl(user, pass, email)VALUES('$user', '$enc', '$email')");
|
|
I receive this error attempting to insert some text into the DB
Parse error: syntax error, unexpected T_STRING in /hosted/domains/d/c/dcfilms.org/public_html/register.php on line 17
My script:
I realize it's not the best method for registrating, etc etc. But it's just a side-project.Code:<?php $host="mysql"; // Host name $username="15557_test"; // Mysql username $password="********"; // Mysql password $db_name="15557_test"; // Database name $tbl="Users"; // Table name mysql_connect("$host", "$username", "$password")or die("cannot connect to server"); mysql_select_db("$db_name")or die("cannot select DB"); $passw = $_POST["pass"]; $enc = md5($passw); $user = $_POST["user"]; $email = $_POST["email"]; echo "Username: " . $user . "<br />"; echo "Password: " . $enc . "<br />"; echo "E-mail: " . $email . "<br />"; INSERT INTO $tbl(user, pass, email)VALUES('$user', '$enc', '$email') //line 17 echo "Account " . $user . " created! Log in <a href="loginn.php">here</a> ?>
Thanks in advance
EDIT:
I'm retarded lol. Mod or admin close this please...

mysql_query ("INSERT INTO $tbl(user, pass, email)VALUES('$user', '$enc', '$email')");

Yes, but before I read the thread I was looking at the code and realized I tried to make a query without the prefix.
Do you know how I could display message when a username already exists in the DB? This is my first registration system that I made w/ out a tut etc etc. I already have the username set to "unique".

Code:$query = mysql_query ("INSERT INTO $tbl(user, pass, email)VALUES('$user', '$enc', '$email')"); if (!$query) { echo("<SCRIPT LANGUAGE='JavaScript'> window.alert('Username already exists.') </SCRIPT>"); }
| « Suggestion | skins » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |