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.

Checkbox&datensatz?

Empfohlene Antworten

Hi Leutz.

Bin neu hier und hab ne Frage zu PHP/SQL.

Wie koppele ich eine Checkbox an einen Datensatz um zum Beispiel bei mehreren Ergebnissen einer Abfrage bestimmte Ergebnisse zu löschen?

Hat da vielleicht jemand ne Idee?

thx

Hallo,

ich weiss zwar nicht genau was du willst, aber ich rate mal.

<input type="checkbox" name="cbutton[]" value="PRIMARY_KEY">

<input type="checkbox" name="cbutton[]" value="PRIMARY_KEY">

while(list($k, $v) = each($cbutton)) {

  if ($v.length()>0){

    statement = "delete from table where PRIMARY_KEY = $v";

  }

}

Syntaxfehler musst du selber rausfiltern :D

Gruß Jaraz

Man kann ja auch die Ergebnistabelle in HTML als Tabelle ausgeben. Da ist es kein Problem kein Problem vor der ersten Zelle noch eine Checkbox zu ergänzen:


$Zeilen=mysql_num_rows($ergebnis);
$Spalten=mysql_num_fields($ergebnis);

for ($i=0; $i<$Zeilen; $i++)
{
echo " <tr>\n";
echo " <td>\n";
echo " <input type=\"checkbox\" name=\"box$i\"></input>\n";
echo " </td>";
for($j=0; $j<$Spalten; $j++)
{
echo " <td>\n";
echo mysql_result($ergebnis,$i,$j);
echo " </td>\n";
}
echo " </tr>\n";
}
[/PHP]

Bei der Auswertung kannst du dann prüfen, ob diese box gesetzt wurde:

[PHP]
for ($i=0; $i<$AnzahlDerBoxen; $i++)
{
$temp[i]="box$i";
if ($$temp[i])
{
$count++; //ergibt Anzahl der gewählten Boxen
$Temp=mysql_result($ergebnis,$i,$Spalte);
$Klausel[]="Spalte=$Temp"; //Teil eines SQLStrings (WHERE Spalte=...)
}

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.