-
-
Save LOCOSP/644da71257266df484521736344e161d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//loop test | |
$result = mysqli_query($link, 'SELECT * FROM `supply` WHERE id=' . intval($_SESSION["id"])); | |
$rows = array(); | |
while($row = mysqli_fetch_array($result)) | |
$rows[] = $row; | |
foreach($rows as $row){ | |
$ename = stripslashes($row['supplier_name']); | |
$produkt = stripslashes($row['product_name']); | |
$color = stripslashes($row['color_color']); | |
$quantity = stripslashes($row['quantity']); | |
$received = stripslashes($row['received']); | |
echo $received . '<br />'; | |
echo $ename . '<br />'; | |
echo $produkt . ' ' . $color . '<br />'; | |
echo $quantity . '<br />'; |
oberwało Ci loopa
$result = mysqli_query($link, 'SELECT * FROM `supply` WHERE id=' . intval($_SESSION["id"]));
$rows = array();
//
while($row = mysqli_fetch_array($result)) {
$rows[] = $row;
}
//
print_r($rows);
//
foreach($rows as $row) {
$ename = stripslashes($row['supplier_name']);
$produkt = stripslashes($row['product_name']);
$color = stripslashes($row['color_color']);
$quantity = stripslashes($row['quantity']);
$received = stripslashes($row['received']);
echo $received . '<br />';
echo $ename . '<br />';
echo $produkt . ' ' . $color . '<br />';
echo $quantity . '<br />';
}
header('Content-Type: text/plain; charset=utf-8');
$query = 'SELECT * FROM `supply` WHERE id=' . intval($_SESSION["id"]);
echo $query;
$result = mysqli_query($link, $query);
$rows = array();
//
while($row = mysqli_fetch_array($result)) {
$rows[] = $row;
}
//
print_r($rows);
//
foreach($rows as $row) {
$ename = stripslashes($row['supplier_name']);
$produkt = stripslashes($row['product_name']);
$color = stripslashes($row['color_color']);
$quantity = stripslashes($row['quantity']);
$received = stripslashes($row['received']);
echo $received . '<br />';
echo $ename . '<br />';
echo $produkt . ' ' . $color . '<br />';
echo $quantity . '<br />';
}
// Nagłówek tekstowy - wyswietlamy tekst a nie html (nie potrzebujemy wtedy <br> i print_r wygląda czytelniej)
header('Content-Type: text/plain; charset=utf-8');
//
$query = 'SELECT * FROM `supply` WHERE id=' . intval($_SESSION["id"]);
// Podgląd zapytania, które zaraz wykonamy:
echo $query . PHP_EOL;
// wykonujemy zapytanie
$result = mysqli_query($link, $query);
// Tworzymy pustą tablicę, która będzie przechowywać wiersze wyniku
$rows = array();
// Iterujemy przez wszystkie wiersze wyniku i wpisujemy do tablicy wierszy
while($row = mysqli_fetch_array($result)) {
$rows[] = $row;
}
// Profilaktycznie wyświetlamy, co zebraliśmy w tablicy $rows:
print_r($rows);
//
foreach($rows as $row) {
$ename = stripslashes($row['supplier_name']);
$produkt = stripslashes($row['product_name']);
$color = stripslashes($row['color_color']);
$quantity = stripslashes($row['quantity']);
$received = stripslashes($row['received']);
echo $received . PHP_EOL;
echo $ename . PHP_EOL;
echo $produkt . ' ' . $color . PHP_EOL;
echo $quantity . PHP_EOL;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pisz ładnie