PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Was ist hier falsch?


R300
2006-03-13, 15:55:51
Hallo

Ich muss das in meine Datenbank einfügen:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_lines', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_wordwrap', '100');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_font_sizes', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_min_font_size', '7');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_font_size', '12');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_bold', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_italic', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_underline', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_colors', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_quote', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_code', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_list', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_url', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_images', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_images', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_img_height', '75');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_img_width', '500');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_on_max_img_size_fail', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_img_files_size', '10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_max_img_av_files_size', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_exotic_bbcodes_disallowed', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_allow_smilies', '1');
ALTER TABLE phpbb_users ADD user_allowsignature TINYINT not null DEFAULT '1';

Bekomme aber diese Fehlermeldung wenn ich das tun will:
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 '; INSERT INTO phpbb_config (config_name, config_value) VALUES(


Kann mir jemand sagen was im oberen Code falsch ist?

THX :massa:

Gast
2006-03-13, 16:16:51
Vielleicht gibts die Tabelle/die Spalten mit diesem Namen nicht? Geht ein einzelnes INSERT INTO durch?

R300
2006-03-13, 16:44:29
Doch diese Zeilen sind z.B. bereits in der Datenbank vorhanden:
INSERT INTO phpbb_config (config_name, config_value) VALUES('cookie_domain', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES('cookie_secure', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('session_length', '3600');


Ich glaube da kommt kein einziges der neuen INSERT INTO durch.

Gast
2006-03-13, 17:09:08
Ich glaube da kommt kein einziges der neuen INSERT INTO durch.
Glauben oder Wissen bzw. Fehlermeldung?

R300
2006-03-13, 17:15:28
Ich bekomme nur die oben genannte Fehlermeldung.

Naja nochmal zur verdeutlichung welchen Script ich benutze zum einfügen:


<?php
/* datenbank angaben */

$benutzer = "xxx"; //dein benutzername
$passwort = "xxx"; //dein passwort
$db = "xxx"; //Datenbank Name
$host = "localhost"; //host(meistens localhost)


/* Datenbank connect */

$link = mysql_connect($host, $benutzer, $passwort);
if (! $link)
die("Keine Verbindung zu MySQL<br>");
print "Verbindung zum Server hergestellt<br>";
mysql_select_db($db)
or die("konnte Datenbank \"$db\" nicht öffnen:<br> ".mysql_error() );
print "Datenbank \"$db\" erfolgreich ausgewählt";

/*erzeutgt die tabellen*/

$ergebnis=mysql_query("INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_lines', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_wordwrap', '100');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_font_sizes', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_min_font_size', '7');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_font_size', '12');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_bold', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_italic', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_underline', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_colors', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_quote', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_code', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_list', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_url', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_images', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_images', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_height', '75');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_width', '500');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_on_max_img_size_fail', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_files_size', '10');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_av_files_size', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_exotic_bbcodes_disallowed', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_smilies', '1');
ALTER TABLE phpbb_users ADD user_allowsignature TINYINT not null DEFAULT '1';");
if(!$ergebnis){
echo
mysql_error();
}
else{
echo"
Tabelle erstellt";
}
mysql_close($link);
?>


Und wenn ich den Ausführe bekomme ich halt die Fehlermeldung:

Verbindung zum Server hergestellt
Datenbank "d0025d6e" erfolgreich ausgewähltYou have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '; INSERT INTO phpbb_config (config_name, config_value) VALUES(

R300
2006-03-14, 14:37:56
*push* weiß es keiner? :redface:

darph
2006-03-14, 16:00:20
INSERT INTO phpbb_config (config_name, config_value) VALUES ('sig_exotic_bbcodes_disallowed', '');

Kann es sein, daß ein leerer String als äquivalent zu null gewertet wird und die Tabelle "not null" ist?

Kann das fehlende Leerzeichen hinter VALUES ein Problem sein?

Sind es vielleicht einfach zu viele Statements für das eine Query?

R300
2006-03-14, 16:04:44
Nein, das ist es leider auch nicht.
Ich hab die Zeile zum testen gelöscht, aber immer noch die selbe Fehlermeldung.

Das Leerzeichen ist es auch nicht, aber ich versuchs mal mit weniger statements


EDIT: OK wenn ich jede Zeile einzeln Eintragen lasse funktioniert es, aber warum nur dann???

MadMan2k
2006-03-14, 18:30:00
die anweisungen werden nciht automatisch am semikolon getrennt - du musst das manuell oder über phpmyadmin machen...

R300
2006-03-14, 21:40:46
Wie kann ich die denn trennen? oder geht das nur wenn ich jedes mal mysql_query davor schreibe?

MadMan2k
2006-03-14, 22:25:49
http://de.php.net/manual/de/function.explode.php

Marscel
2006-03-14, 22:45:35
$queries = "INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_lines', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_wordwrap', '100');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_font_sizes', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_min_font_size', '7');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_font_size', '12');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_bold', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_italic', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_underline', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_colors', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_quote', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_code', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_list', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_url', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_images', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_images', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_height', '75');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_width', '500');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_on_max_img_size_fail', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_files_size', '10');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_max_img_av_files_size', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_exotic_bbcodes_disallowed', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES('sig_allow_smilies', '1');
ALTER TABLE phpbb_users ADD user_allowsignature TINYINT not null DEFAULT '1';";

$query_array = explode(";", $queries);

foreach($query_array as $query)
{
if(mysql_query($query))
{
print "Query erfolgreich!";
}
else
{
print mysql_error();
}
}

R300
2006-03-15, 20:12:29
Vielen Dank! :massa: