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.

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich möchte an MySQL mit PHP mehrere SQL Statements auf einmal absetzen. Irgendwie klappt das aber nicht. Kann mir einer sagen,

was ich da falsch mache??


$db = mysql_connect("localhost", "root", "");

$strQuery = "";
for ($nIndex2 = 0; $nIndex2<100; $nIndex2++) {
$strQuery .= "INSERT INTO product VALUES($nIndex2, 'test$nIndex2', ".(2.5*$nIndex2).", $nIndex2);\n";
}

mysql_query($strQuery, $db);
[/php]

Hallo,

Versuch mal das MySQL Query mit in die Schleife zu nehmen und verzichte auf ".=":


for ($nIndex2 = 0; $nIndex2<100; $nIndex2++) { 

  $strQuery = "INSERT INTO product VALUES($nIndex2, 'test$nIndex2', ".(2.5*$nIndex2).", $nIndex2);\n"; 

  mysql_query($strQuery, $db); 

} 

Gruß Daniel

Die Idee war halt eben auf die einzelnen myaql_querys zu verzichten und alles in einem Rutsch an die DB zu übergeben. Das wäre performanter gewesen. Ich kenn das von ODBC und glaub auch JDBC, das sowas möglich ist. Dachte auch das es bei PHP geht, da hab ich aber wohl nicht richtig recherchiert... :-)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.