English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hi guys...
i have a site that is programmed with php, well and the database that i'm using is mysql.
before hosting the file everything was ok and i could enter data and retreive it from database.
today i have host it but the database have something wrong which i dont know what is it,icant insert data nor retrieving it
it gives me this error:
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 'DEFAULT CHARSET=latin1 AUTO_INCREMENT=5' at line 6
soo please if anyone can help plz do and i will be sooo thankful

2007-03-08 00:32:34 · 3 answers · asked by MonMon 1 in Computers & Internet Programming & Design

3 answers

Hello,

You 'CANNOT' place AUTO_INCREMENT=5 in a table create statement;

CREATE your table first for instance.

mysql> CREATE TABLE yourtable (
-> id INTEGER AUTO_INCREMENT,
-> data TEXT,
-> PRIMARY KEY (id));

Then... alter the INCREMENT to be 5 (as you wish) Dunno why your doing that since when you create a table, it begins with 0;

mysql> ALTER TABLE yourtable AUTO_INCREMENT=5;
Query OK, 0 rows affected (0.11 sec)
Records: 0 Duplicates: 0 Warnings: 0

mysql> INSERT INTO yourtable(data) VALUES('hello'),('hey');
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0

mysql> select * from yourtable;
+----+-------+
| id | data |
+----+-------+
| 5 | hello |
| 6 | hey |
+----+-------+
2 rows in set (0.02 sec)

Now notice the id has changed with respect to your increment.

Good Luck

2007-03-13 17:13:44 · answer #1 · answered by ? 6 · 1 0

use the password for the person 'peter@localhost'. provide the password in $con=mysql_connect("localhost","puppy... this could sparkling up your situation. whether you could edit the mysql database utilising kit PHPmyadmin and alter as Password='No' for the person, 'peter@localhost'.

2016-11-23 15:05:12 · answer #2 · answered by Anonymous · 0 0

The error is near this line. It may not be on this line.
You need to show more code.

2007-03-08 00:52:41 · answer #3 · answered by AnalProgrammer 7 · 0 1

fedest.com, questions and answers