alex1985 0 Report post Posted March 8, 2008 Hi, everyone! What is the mistake over here? 'id' INT(11) NOT NULL AUTO_INCREMENT,'username' VARCHAR(255) NOT NULL,'password' VARCHAR(255) NOT NULL,PRIMARY KEY ('id')) TYPE MYISAM; linenums:0'>CREATE TABLE '1_users' ('id' INT(11) NOT NULL AUTO_INCREMENT,'username' VARCHAR(255) NOT NULL,'password' VARCHAR(255) NOT NULL,PRIMARY KEY ('id')) TYPE MYISAM;The PHPMyAdmin states:#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1_users' ('id' INT(11) NOT NULL AUTO_INCREMENT,'username' VARCHAR(255) NOT ' at line 1 Please, let me know as soon as possible? Share this post Link to post Share on other sites
rvalkass 5 Report post Posted March 8, 2008 This is a simple case of the wrong quotes. You need to use ` rather than '. The following should work: CREATE TABLE `1_users` (`id` INT(11) NOT NULL AUTO_INCREMENT,`username` VARCHAR(255) NOT NULL,`password` VARCHAR(255) NOT NULL,PRIMARY KEY (`id`)) TYPE MYISAM; Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 Oh, so easy!!! Thanks for answering, it's good to learn through your forum, replies got answered so fast. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 Sorry, but the PHPMyAdmin still gives the following: SQL query:CREATE TABLE `users` (`id` INT( 11 ) NOT NULL AUTO_INCREMENT ;MySQL said: Documentation#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 2 Share this post Link to post Share on other sites
rvalkass 5 Report post Posted March 8, 2008 OK, try the following: CREATE TABLE `1_users` (`id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,`username` VARCHAR( 255 ) NOT NULL ,`password` VARCHAR( 255 ) NOT NULL) ENGINE = MYISAM If that doesn't work, add the database name before the table name, so the first line would become: CREATE TABLE `databasename`.`1_users` ( Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 So, I need to make spaces between words and brackets?! Correct me, I I'm being wrong! Share this post Link to post Share on other sites
rvalkass 5 Report post Posted March 8, 2008 Well, I just ran that code on my own MySQL installation and it worked perfectly. I have found in the past that it can be a little picky about what it lets through and what it doesn't. Â If that code still doesn't work, use phpMyAdmin to create the table, and copy the MySQL query it actually runs (it will be displayed to you after the table is created). Then you can be certain that code will work. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 Well, I just ran that code on my own MySQL installation and it worked perfectly. I have found in the past that it can be a little picky about what it lets through and what it doesn't. Â If that code still doesn't work, use phpMyAdmin to create the table, and copy the MySQL query it actually runs (it will be displayed to you after the table is created). Then you can be certain that code will work. What's about my previous question? Share this post Link to post Share on other sites
truefusion 3 Report post Posted March 8, 2008 So, I need to make spaces between words and brackets?Spaces (and new lines) are optional. It should work so long as you follow the syntax, like the error says. SQL query parse errors can be annoying. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 8, 2008 Thank you. I got it. If I have any more questions I let you know. Share this post Link to post Share on other sites
galexcd 0 Report post Posted March 10, 2008 This is a simple case of the wrong quotes. You need to use ` rather than '. The following should work:Thats odd... I've never known that before. I've sometimes used ` but usually I use ' and they both seem to run fine on sql. Are you sure about this? Share this post Link to post Share on other sites
rvalkass 5 Report post Posted March 10, 2008 Thats odd... I've never known that before. I've sometimes used ` but usually I use ' and they both seem to run fine on sql. Are you sure about this?I've found that sometimes it makes a difference. If I remember correctly, the difference is something similar to single quotes and double quotes in PHP. If you use a single quote in SQL, then whatever is between the single quotes will be parsed. If you use backticks (that's the ` character) then it is not parsed. This allows you to use words like INT in column names, which would otherwise be parsed by MySQL, throwing up an error as it would make no sense. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 10, 2008 I found one tutorial how to make a complete login system which suggest to use the following SQL syntax to encrypt the password: INSERT INTO login (username,password,email,activated) value ('admin',sha1(concat('yourpasswordhere','0dAfghRqSTgx')),'youremailhere','1'); Is it appropriate or not?! Share this post Link to post Share on other sites
jlhaslip 4 Report post Posted March 10, 2008 Looks good to me. Try it on a test database and let us know if it works.What it is saying is to Insert into this table, the list of fields listed inside the first round brackets, the list of values found in the second set of round brackets. The list of fields and their values should be in the same order.The 'password' will be an encrypted value of the concatenated literal password and a 'salt'. This is more secure than simply encrypting the password by itself, but the same 'salt' should be used when you compare any passwords they use on log-in, so it needs to be stored someplace. Share this post Link to post Share on other sites
alex1985 0 Report post Posted March 10, 2008 Well, I just wanna ask you if it's good or appropriate way to encrypt the password. I checked the entry on PHPMyAdmin, and it does really encrypt the password. So, I can do that?! Share this post Link to post Share on other sites