SELFPHP: Version 5.8.2 Befehlsreferenz - Tutorial – Kochbuch – Forum für PHP Einsteiger und professionelle Entwickler

SELFPHP


Professional CronJob-Service

Suche



CronJob-Service    
bei SELFPHP mit ...



 + minütlichen Aufrufen
 + eigenem Crontab Eintrag
 + unbegrenzten CronJobs
 + Statistiken
 + Beispielaufrufen
 + Control-Bereich

Führen Sie mit den CronJobs von SELFPHP zeitgesteuert Programme auf Ihrem Server aus. Weitere Infos



:: Buchempfehlung ::

Websites optimieren für Google & Co.

Websites optimieren für Google & Co. zur Buchempfehlung
 

:: Anbieterverzeichnis ::

Globale Branchen

Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP  

 

:: Newsletter ::

Abonnieren Sie hier den kostenlosen SELFPHP Newsletter!

Vorname: 
Name:
E-Mail:
 
 

Zurück   PHP Forum > SELFPHP > MySQLi/PDO/(MySQL)

MySQLi/PDO/(MySQL) Anfänger, Fortgeschrittene oder Experten können hier Fragen und Probleme rund um MySQLi/PDO/(MySQL) diskutieren

 
 
Themen-Optionen Ansicht
  #1  
Alt 15.03.2016, 15:43:00
Bengelbaer Bengelbaer ist offline
Anfänger
 
Registriert seit: Mar 2016
Alter: 44
Beiträge: 2
Datenübergabe Array -> Datenbank

Hy,

ich bin Michael und Baujahr 1979. Ich arbeite normalerweise im Vertrieb von Werkzeugen, und programmiere nur hobbymäßig etwas.

Hierzu setze ich mir immer Ziele welche ich erreichen möchte.

Aktuell versuche ich Kategorien aus einem Array in eine Datenbank zu schreiben.

Aber irgendwie haut was nicht hin, und ich bin grad etwas betriebsblind.

Daher würde es mich freuen wenn einer mal kurz drüber schauen könnte.

PHP-Code:
$conn = new mysqli($zDbHost$zDbUser$zDbPass$zDbDb);

                    
/* check connection */
if ($conn->connect_error) {
    die(
"Connection failed: " $mysqli->connect_error);

//////////////////////////////////////////Schleife für Kategorienerstellung////////////////////////////////////
foreach ($xmlstr->Items->Item as $row) {
        
$date date("Y-m-d H:i:s");
        
$MainCategorie $row->Main_ProductGroup;

                
$queryMainKat "INSERT INTO s_categories (id, 
                                                            parent,
                                                            path,
                                                            description,
                                                            position,
                                                            left,
                                                            right,
                                                            level,
                                                            added,
                                                            changed,
                                                            metakeywords,
                                                            metadescription,
                                                            cmsheadline,
                                                            cmstext,
                                                            template,
                                                            noviewselect,
                                                            active,
                                                            blog,
                                                            showfiltergroups,
                                                            external,
                                                            hidefilter,
                                                            hidetop,
                                                            mediaID,
                                                            product_box_layout,
                                                            meta_title,
                                                            stream_id)

                                                            VALUES 
                                                            
                                                            ('',
                                                            '"
.$hauptKatId."',
                                                            '|"
.$hauptKatId."|',
                                                            '"
.$MainCategorie."',
                                                            NULL,
                                                            '0',
                                                            '0',
                                                            '0',
                                                            '"
.$date."',
                                                            '"
.$date."',
                                                            NULL,
                                                            '',
                                                            '',
                                                            '',
                                                            'article_listing_4col.tpl',
                                                            '0',
                                                            '1',
                                                            '0',
                                                            '1',
                                                            '',
                                                            '0',
                                                            '0',
                                                            NULL,
                                                            'basic',
                                                            '',
                                                            NULL )"
;
                if (
$conn->query($queryMainKat) === TRUE) {
                    echo 
"New record created successfully";
                    } else {
                    echo 
"Error: " $queryMainKat "<br>" $conn->error;}

                
$MainKatId "Select id from s_categories where description = '" $MainCategorie "'";
                if (
$conn->query($MainKatId) === TRUE) {
                    echo 
"New record found successfully";
                    } else {
                    echo 
"Error: " $MainKatId "<br>" $conn->error;}

                
$queryMainKat_attr "INSERT INTO s_categories_attributes (id,categoryID,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6) VALUES (NULL,'".$MainKatId."','','','','','','' )";
                if (
$conn->query($queryMainKat_attr) === TRUE) {
                    echo 
"New record created successfully";
                    } else {
                    echo 
"Error: " $queryMainKat_attr "<br>" $conn->error;}
                 
                echo 
$conn->error;
                
///Durchlaufbegrenzung                        
                    
if ($i==3) break;
                    
$i++;    
}; 
und hier die Ausgabe

Code:
Error: INSERT INTO s_categories (id, parent, path, description, position, left, right, level, added, changed, metakeywords, metadescription, cmsheadline, cmstext, template, noviewselect, active, blog, showfiltergroups, external, hidefilter, hidetop, mediaID, product_box_layout, meta_title, stream_id) VALUES ('', '3', '|3|', 'Lebensmittelbeutel aus Papier ', NULL, '0', '0', '0', '2016-03-15 15:33:13', '2016-03-15 15:33:13', NULL, '', '', '', 'article_listing_4col.tpl', '0', '1', '0', '1', '', '0', '0', NULL, 'basic', '', NULL )
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 'left, right, level, added, ' at line 6Error: Select id from s_categories where description = 'Lebensmittelbeutel aus Papier '
Error: INSERT INTO s_categories_attributes (id,categoryID,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6) VALUES (NULL,'Select id from s_categories where description = 'Lebensmittelbeutel aus Papier '','','','','','','' )
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 'Lebensmittelbeutel aus Papier '','','','','','','' )' at line 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Lebensmittelbeutel aus Papier '','','','','','','' )' at line 1Error: INSERT INTO s_categories (id, parent, path, description, position, left, right, level, added, changed, metakeywords, metadescription, cmsheadline, cmstext, template, noviewselect, active, blog, showfiltergroups, external, hidefilter, hidetop, mediaID, product_box_layout, meta_title, stream_id) VALUES ('', '3', '|3|', 'Servietten "ROYAL Collection"', NULL, '0', '0', '0', '2016-03-15 15:33:13', '2016-03-15 15:33:13', NULL, '', '', '', 'article_listing_4col.tpl', '0', '1', '0', '1', '', '0', '0', NULL, 'basic', '', NULL )
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 'left, right, level, added, ' at line 6Error: Select id from s_categories where description = 'Servietten "ROYAL Collection"'
Error: INSERT INTO s_categories_attributes (id,categoryID,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6) VALUES (NULL,'Select id from s_categories where description = 'Servietten "ROYAL Collection"'','','','','','','' )
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 'Servietten "ROYAL Collection"'','','','','','','' )' at line 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Servietten "ROYAL Collection"'','','','','','','' )' at line 1Error: INSERT INTO s_categories (id, parent, path, description, position, left, right, level, added, changed, metakeywords, metadescription, cmsheadline, cmstext, template, noviewselect, active, blog, showfiltergroups, external, hidefilter, hidetop, mediaID, product_box_layout, meta_title, stream_id) VALUES ('', '3', '|3|', 'Servietten "ROYAL Collection"', NULL, '0', '0', '0', '2016-03-15 15:33:13', '2016-03-15 15:33:13', NULL, '', '', '', 'article_listing_4col.tpl', '0', '1', '0', '1', '', '0', '0', NULL, 'basic', '', NULL )
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 'left, right, level, added, ' at line 6Error: Select id from s_categories where description = 'Servietten "ROYAL Collection"'
Error: INSERT INTO s_categories_attributes (id,categoryID,attribute1,attribute2,attribute3,attribute4,attribute5,attribute6) VALUES (NULL,'Select id from s_categories where description = 'Servietten "ROYAL Collection"'','','','','','','' )
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 'Servietten "ROYAL Collection"'','','','','','','' )' at line 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Servietten "ROYAL Collection"'','','','','','','' )' at line 15.997079 Sekunden

vermutlich ist es ein einfacher Fehler.

Vielen Dank schon mal.
Mit Zitat antworten
 


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind aus.
[IMG] Code ist aus.
HTML-Code ist aus.

Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Anfängerproblem mit Formular-Ausgabe robertdeniro PHP Grundlagen 0 13.10.2006 11:11:50
anfängerproblem bei einem code pascalplus PHP Grundlagen 3 21.10.2004 14:40:40
frage zu explode wahrscheinlich anfängerproblem saidbuchari PHP Grundlagen 3 04.11.2003 08:16:01
Anfängerproblem (bzgl. Array) Carsten25 PHP für Fortgeschrittene und Experten 2 27.01.2003 08:18:12
Emailversand (Anfängerproblem !) Albtraum PHP für Fortgeschrittene und Experten 20 31.08.2002 09:57:45


Alle Zeitangaben in WEZ +2. Es ist jetzt 08:44:14 Uhr.


Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.


© 2001-2024 E-Mail SELFPHP OHG, info@selfphp.deImpressumKontakt