Toon posts:

[SQL] Probleem met invoeren queries

Pagina: 1
Acties:
  • 53 views sinds 30-01-2008

Verwijderd

Topicstarter
Vorige probleem heb ik opgelost, maar hier kom ik echt niet uit..

Origineel stond er in een phpNuke bestandje dit:

code:
1
2
3
4
5
6
7
8
9
10
11
$sql[] = "ALTER TABLE " . FORUMS_TABLE . " ADD points_disabled TINYINT(1) NOT NULL AFTER prune_enable"; 
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD user_notify_donation TINYINT(1) NOT NULL AFTER user_notify_pm"; 
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD user_points INT NOT NULL"; 
$sql[] = "ALTER TABLE " . USERS_TABLE . " ADD admin_allow_points TINYINT(1) DEFAULT '1' NOT NULL"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_reply', '1')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_topic', '2')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_post', '1')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_donate', '1')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_name', 'Points')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_user_group_auth_ids', '')"; 
$sql[] = "INSERT INTO " . CONFIG_TABLE . " VALUES ('points_system_version', '2.0.9')";


Maar om het in phpmyadmin in te voeren moet dat natuurlijk anders. Zo dacht ik:

code:
1
2
3
4
5
6
7
8
9
10
11
ALTER TABLE nuke_bbforums ADD points_disabled TINYINT(1) NOT NULL AFTER prune_enable; 
ALTER TABLE nuke_users ADD user_notify_donation TINYINT(1) NOT NULL AFTER user_notify_pm; 
ALTER TABLE nuke_users ADD user_points INT NOT NULL; 
ALTER TABLE nuke_users ADD admin_allow_points TINYINT(1) DEFAULT '1' NOT NULL; 
INSERT INTO nuke_bbconfig VALUES ('points_reply', '1'); 
INSERT INTO nuke_bbconfig VALUES ('points_topic', '2'); 
INSERT INTO nuke_bbconfig VALUES ('points_post', '1'); 
INSERT INTO nuke_bbconfig VALUES ('points_donate', '1'); 
INSERT INTO nuke_bbconfig VALUES ('points_name', 'Points'); 
INSERT INTO nuke_bbconfig VALUES ('points_user_group_auth_ids', ''); 
INSERT INTO nuke_bbconfig VALUES ('points_system_version', '2.0.9');


Maar dit is blijkbaar fout want er komen foutmeldingen :|

Zouden die ' ' ook weg moeten?

En wat is er dan mis met een regel als:

code:
1
ALTER TABLE nuke_bbforums ADD points_disabled TINYINT(1) NOT NULL AFTER prune_enable;

  • eamelink
  • Registratie: Juni 2001
  • Niet online

eamelink

Droptikkels

er komen foutmeldingen
Debuggen les 1 : lees de foutmelding.

Na betaling van het cursusgeld eventueel overige lessen 8)7

[ Voor 4% gewijzigd door eamelink op 19-04-2005 17:27 ]


Verwijderd

Topicstarter
Bijvoorbeeld dit bij de ALTER

code:
1
2
3
4
5
6
7
SQL-query:

ALTER TABLE nuke_users ADD user_notify_donation TINYINT( 1 ) NOT NULL AFTER user_notify_pm

MySQL retourneerde:

#1060 - Duplicate column name 'user_notify_donation'


En dit bij de INSERT

code:
1
2
3
4
5
6
7
8
9
10
 SQL-query:

INSERT INTO nuke_bbconfig
VALUES (
''points_reply '', ''1 ''
)

MySQL retourneerde

#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 'points_reply'', ''1'')' at line 1

  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 06-05 18:51

Creepy

Tactical Espionage Splatterer

Zie eamelink. Debuggen doen we hier zelf. Als je foutmeldingen krijgt: lees ze eens en probeer aan de hand daarvan de problemen op te lossen.

Als je er dan nog niet uit komt dan kan je hier een topic openen. Geef dan wel aan wat je nu zelf al hebt geprobeerd, wat daar niet mee lukte en post de daarbij eventuele relevante code.

Tip: twee keer ' achter elkaar is niet iets wat MySQL leuk vindt gok ik ;)

Zie ook P&W FAQ - De "quickstart" en lees dat ding dan ook VOORDAT je een nieuw topic opent!

[ Voor 15% gewijzigd door Creepy op 19-04-2005 17:35 ]

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


Dit topic is gesloten.