Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[MySQL] Fremschlüssel-Problem

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

irgendwie steh ich gerade auf dem Schlauch.

Ich versuche folgende Tabellen in meinen Server einzuspielen, aber ich kriege bei der news-tabelle immer den selben Fehler:

#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 'PRIMARY KEY(news_id)

FOREIGN KEY (fk_user_id) REFERENCES users (user_id)

ON ' at line 7

Hier die Tabellen:

CREATE TABLE users (

  user_id 	INTEGER UNSIGNED   	NOT NULL AUTO_INCREMENT,

  username 	VARCHAR(20)   		NOT NULL ,

  firstname 	VARCHAR(20)   		NOT NULL ,

  name 		VARCHAR(20)   		NOT NULL ,

  street 	VARCHAR(20)   		NOT NULL ,

  city 		VARCHAR(20)  		NOT NULL ,

  zip 		SMALLINT UNSIGNED   	NOT NULL ,

  country 	VARCHAR(20)   		NOT NULL ,

  email 	VARCHAR(20)   		NOT NULL ,

  md5pwd 	VARCHAR(30)   		NOT NULL ,

  admin 	TINYINT UNSIGNED  DEFAULT 0 NOT NULL   ,

PRIMARY KEY(user_id)

)TYPE=InnoDB;





CREATE TABLE news (

  news_id	INTEGER UNSIGNED	NOT NULL AUTO_INCREMENT,

  fk_user_id 	INTEGER UNSIGNED   	NOT NULL ,

  date 		DATETIME   		NOT NULL ,  

  info 		MEDIUMTEXT  		NOT NULL ,

INDEX (fk_user_id)

PRIMARY KEY(news_id)

	FOREIGN KEY (fk_user_id) REFERENCES users (user_id)

	ON UPDATE CASCADE 

)TYPE=InnoDB;

Könnte mich jemand von der Leitung schubsen auf der ich steh?

gnarf :old

Danke für´s Schubsen!

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.