Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [php]błąd mysql
Forum PHP.pl > Forum > PHP
Pcbecaw
Gdy dodaję taki kod do phpmyadmin:
  1. CREATE TABLE ´informit_tags´ (
  2. ´id´ int(11) NOT NULL auto_increment,
  3. ´name´ varchar(50) NOT NULL default ’’,
  4. ´count´ int(11) NOT NULL default ’0’,
  5. PRIMARY KEY (´id´)
  6. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17

Wywala mi błąd:#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 '’’, ´count´ int(11) NOT NULL default ’0’, PRIMARY KEY (´id´) ) ' at line 3
O co chodzi?
IceManSpy
Chodzi o poprawnie napisane zapytanie:
  1. CREATE TABLE informit_tags (
  2. id int(11) NOT NULL AUTO_INCREMENT,
  3. name varchar(50) NOT NULL DEFAULT '',
  4. count int(11) NOT NULL DEFAULT '0',
  5. PRIMARY KEY (id)
  6. ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=17
Pcbecaw
Dzięki, próbowałem poprawiać jeszcze to:
  1. INSERT INTO ´informit_tags´ (´id´, ´name´, ´count´) VALUES (1, ’ajax’, 20),
  2. (2, ’php’, 25),
  3. (3, ’mysql’, 5),
  4. (4, ’javascript’, 10),
  5. (5, ’coldfusion’, 25),
  6. (6, ’java’, 2),
  7. (7, ’html’, 50),
  8. (8, ’css’, 30),
  9. (9, ’actionscript’, 20),
  10. (10, ’c#’, 40),
  11. (11, ’dhtml’, 10),
  12. (12, ’xml’, 15),
  13. (13, ’xhtml’, 30),
  14. (14, ’visual basic’, 1),
  15. (15, ’cfml’, 20),
  16. (16, ’asp’, 30);

usuwałem te odwrocone apostrofy i nic. Gdzie to trzeba poprawiać?

to
  1. ’
jest tym ' (tyle że odwróconym), nie wiem dlaczego tak się wyświetla
IceManSpy
Bo nie ma być odwrócony apostrof, tylko zwykły. Taki -> '
  1. INSERT INTO ´informit_tags´ (´id´, ´name´, ´count´) VALUES (1, 'ajax', 20),
  2. (2, 'php', 25),
  3. (3, 'mysql', 5),
  4. (4, 'javascript', 10),
  5. (5, 'coldfusion', 25),
  6. (6, 'java', 2),
  7. (7, 'html', 50),
  8. (8, 'css', 30),
  9. (9, 'actionscript', 20),
  10. (10, 'c#', 40),
  11. (11, 'dhtml', 10),
  12. (12, 'xml', 15),
  13. (13, 'xhtml', 30),
  14. (14, 'visual basic', 1),
  15. (15, 'cfml', 20),
  16. (16, 'asp', 30);
Pcbecaw
Wyświetla się taki błąd:
  1. #1146 - Table 'testy.´informit_tags´' doesn't exist
  2. INSERT INTO ´informit_tags´( ´id´, ´name´, ´count´ )
  3. VALUES ( 1, 'ajax', 20 ) , ( 2, 'php', 25 ) , ( 3, 'mysql', 5 ) , ( 4, 'javascript', 10 ) , ( 5, 'coldfusion', 25 ) , ( 6, 'java', 2 ) , ( 7, 'html', 50 ) , ( 8, 'css', 30 ) , ( 9, 'actionscript', 20 ) , ( 10, 'c#', 40 ) , ( 11, 'dhtml', 10 ) , ( 12, 'xml', 15 ) , ( 13, 'xhtml', 30 ) , ( 14, 'visual basic', 1 ) , ( 15, 'cfml', 20 ) , ( 16, 'asp', 30 ) ;


Były małe błędy, ale już poprawiłem snitch.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.