Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> pusta tabela, zapytanie zwraca 217 rekordów danych nie widać
mika1
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 15.05.2007

Ostrzeżenie: (0%)
-----


Witajcie,

korzystam z gotowca pobranego z http://www.datatables.net/ . W pliku new2.php mam fragment w ktorym wycagam dane z bazy. Zapytanie wykonuje sie, pętla wykonuje się tyle razy ile jest zwróconych rekordów ale danych w tabeli nie widać.

Kod
<?php
include('index.php');
include "databaseconfig15.php";
//$_SESSION["user_level"]!=1;
//$polaczenie=true;
$zapytanie= 'SELECT Numer, Id, Ilosc, Miara FROM Tabela_1 where Numer in (select Numer from Tabela_2 where Kod = "00-210" and Status = "2")';
$wynik = mysql_query($zapytanie) or die(mysql_error());
?>
<p></p>
<div>
<table  id="datatables">
<thead>
<tr>    
    <th>Numer</th>
    <th>Data</th>
    <th>Ilosc</th>
    <th>Miara</th>
</tr>
</thead>

<tbody>
<?php

while ($rekord = mysql_fetch_assoc($wynik)){
    ?>
    <tr>
        <td><?=$rekord['Numer']?></td>
        <td><?=$rekord['Id']?></td>
                <td><a>xy </a></td>
        <td><?=$rekord['Ilosc']?></td>
        <td><?=$rekord['Miara']?></td>
    </tr>
    <?php
    }
?>
</tbody>
</table>
</div>
</body>
</html>


Zero błędów. Wynik ja poniżej. Tabela z pustymi wierszami a pod nią: Showing 1 to 10 of 217 entries.

Co robię źle?

Z góry dzięuje za pomoc, pozdrawiam
B
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 10)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




nie: <?=$rekord['Numer']?>
a: <?php echo $rekord['Numer']; ?>

Analogicznie reszta
Go to the top of the page
+Quote Post
Pyton_000
post
Post #3





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


@nospor to jest tożsame (IMG:style_emoticons/default/wink.gif)

Autorze kochany. Wiesz co to datatables? Bo chyba nie za bardzo wynikając z tego co piszesz.

Datatables ma za zadanie zdostarczonych danych zbudować właśnie tabelę. Przekazujesz przeważnie JSON do frontu a JS trawi to wypluwając tabelę.
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
@nospor to jest tożsame
No widzisz, nie do konca. Owszem, w ktorejs tam kolejnej wersji php to jest toższame, ale we wczesniejszych już niestety nie (IMG:style_emoticons/default/tongue.gif)
I jesli autor ma nie tę wersje php co trzeba i ma wyłączone SHORT_OPEN_TAG czy jakos tak, to wowczas <?= jest traktowany jako znacznik html (IMG:style_emoticons/default/tongue.gif) x 2

(IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
Pyton_000
post
Post #5





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Racja, ciągle zapominam że "programistom" php czas zatrzymał się na php 4
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




NIe chodzi tu o php4. Jeszcze nawet w php5 wystepuje ten problem. Dopiero od ktoregos tam php5 poprawili to.
Go to the top of the page
+Quote Post
Pyton_000
post
Post #7





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Metafora taka (IMG:style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
nospor
post
Post #8





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Acha... taka metafora jak mój żart z Bółką (IMG:style_emoticons/default/tongue.gif)
Go to the top of the page
+Quote Post
freewalker
post
Post #9





Grupa: Zarejestrowani
Postów: 90
Pomógł: 4
Dołączył: 14.02.2015

Ostrzeżenie: (0%)
-----


a nie powinno być:

  1. <tr>
  2. <td><?=$rekord['numer']?></td>
  3. <td><?=$rekord['id']?></td>
  4. <td><a>xy </a></td>
  5. <td><?=$rekord['ilosc']?></td>
  6. <td><?=$rekord['miara']?></td>
  7. </tr>


zamiast:

  1. <tr>
  2. <td><?=$rekord['Numer']?></td>
  3. <td><?=$rekord['Id']?></td>
  4. <td><a>xy </a></td>
  5. <td><?=$rekord['Ilosc']?></td>
  6. <td><?=$rekord['Miara']?></td>
  7. </tr>


Ten post edytował freewalker 18.02.2015, 23:01:44
Go to the top of the page
+Quote Post
nospor
post
Post #10





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




@freewalker przeciez autor wyraźnie w SELECT pobiera z duzych liter
SELECT Numer, Id, Ilosc, Miara
Naprawde tego nie widzisz?
Go to the top of the page
+Quote Post
mika1
post
Post #11





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 15.05.2007

Ostrzeżenie: (0%)
-----


Cytat
@nospor: nie: <?=$rekord['Numer']?>
a: <?php echo $rekord['Numer']; ?>


to było to (IMG:style_emoticons/default/exclamation.gif) dziekuje (IMG:style_emoticons/default/zakochany.gif)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 28.09.2025 - 10:49