Avatar billede kane Juniormester
28. april 2014 - 07:55 Der er 29 kommentarer

hvad kan fejlen være, min kode køre i loop.

Jeg har en kode, som skal lave en tabel, virker også fint, når der er 1 linje i databasen. Men når jeg smider nye data i, står den bare og køre og køre i langggggggggg tid, og timer så ud.

<?php   

        $query = mysql_query("SELECT * FROM under_a, studie, under_b, bar_fest_indgang, under_c, under_d, sal_1, sal_1b, sal_1c, sal_1d, sal_2, sal_2b, sal_2c, sal_2d, sal_3, sal_3b, sal_3c, sal_3d, sal_4, sal_4b, sal_4c, sal_4d, sal_5, sal_5b, sal_5c, sal_5d, sal_6, sal_6b, sal_6c, sal_6d, sal_7, sal_7b, sal_7c, sal_7d, roof") or die(mysql_error()); 
        while($row = mysql_fetch_array($query))  {
    ?>


<table width="1100" border="0" align="center" cellpadding="0" cellspacing="0" class="bold_font">
  <tr>
    <td width="150" height="25" class="info">&nbsp;<?php echo $row["etDate"]; ?></td>
    <td width="100" height="25" class="info">&nbsp;Lys</td>
    <td width="100" height="25" class="info">&nbsp;Skilt</td>
    <td width="100" class="info" >&nbsp;Brandt&aelig;ppe</td>
    <td width="100" class="info">&nbsp;Brand spr&oslash;jte</td>
      <td width="500" class="info">&nbsp;D&oslash;re</td>
  </tr>
  <tr>


denne kode forsætter så

og tilsidst

  </table>
<br />
<?php } ?>
</body>
</html>
Avatar billede repox Seniormester
28. april 2014 - 08:08 #1
Det er godt nok tåbeligt mange tabeller du henter fra i den query. Umiddelbart forestiller jeg mig det skyldes inner joins mellem alle tabellerne som giver enormt mange linier fra databasen (sikkert også uden indhold).

Jeg tror du skal normalisere din database i stedet.
Avatar billede kane Juniormester
28. april 2014 - 08:28 #2
hmmm ja det er fordi jeg sætter ind fra en app, kan ikke lige hitte ud af hvordan jeg ellers skal gøre.

Men det må være noget andet galt, hvis jeg fjerne alt på nær 1 tabel, så tager det alligevel 100 år.
Avatar billede repox Seniormester
28. april 2014 - 08:37 #3
Hvad mener du med at du sætter ind fra en app?
Avatar billede kane Juniormester
28. april 2014 - 08:44 #4
jeg sætter data ind fra en app jeg har lavet (nye data) men ja det køre jo så også igennem php.......crap, troede ikke det ville give problemer at have så "mange" tabeller
Avatar billede jakobdo Ekspert
28. april 2014 - 08:49 #5
Eneste data du bruger, er feltet: "etDate". Hvilken tabel kommer den fra ?
Avatar billede kane Juniormester
28. april 2014 - 08:51 #6
det er blot fordi jeg ikke gad paste hele koden.

der er ca 5 rækker i hver tabel i databasen.
Avatar billede jakobdo Ekspert
28. april 2014 - 08:58 #7
Kan du ikke prøve at smide din totale kode herind ?
Vi kan jo ikke hjælpe, hvis du ikke viser os alt din kode.
Avatar billede kane Juniormester
28. april 2014 - 09:31 #8
jo men der er ikke så meget i den, anden end den er lang.

  <?php   

        $query = mysql_query("SELECT * FROM under_a, studie, under_b, bar_fest_indgang, under_c, under_d, sal_1, sal_1b, sal_1c, sal_1d, sal_2, sal_2b, sal_2c, sal_2d, sal_3, sal_3b, sal_3c, sal_3d, sal_4, sal_4b, sal_4c, sal_4d, sal_5, sal_5b, sal_5c, sal_5d, sal_6, sal_6b, sal_6c, sal_6d, sal_7, sal_7b, sal_7c, sal_7d, roof") or die(mysql_error()); 
        while($row = mysql_fetch_array($query))  {
    ?>


<table width="1100" border="0" align="center" cellpadding="0" cellspacing="0" class="bold_font">
  <tr>
    <td width="150" height="25" class="info">&nbsp;<?php echo $row["etDate"]; ?></td>
    <td width="100" height="25" class="info">&nbsp;Lys</td>
    <td width="100" height="25" class="info">&nbsp;Skilt</td>
    <td width="100" class="info" >&nbsp;Brandt&aelig;ppe</td>
    <td width="100" class="info">&nbsp;Brand spr&oslash;jte</td>
      <td width="500" class="info">&nbsp;D&oslash;re</td>
  </tr>
  <tr>
    <td height="20" class="split">Underetage</td>
    <td width="50"  class="split">&nbsp;</td>
    <td class="split">&nbsp;</td>
    <td class="split">&nbsp;</td>
    <td class="split">&nbsp;</td>
      <td class="split">&nbsp;</td>
  </tr>
  <tr>
    <td  class="sort_bar">Opgang A</td>
    <td width="50" height="25" class="info" ><?php echo $row["lys"]; ?></td>
    <td class="info"><?php echo $row["skilt"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info"><?php echo $row["door"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">Studie/gang</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_s"]; ?></td>
    <td class="info"><?php echo $row["skilt_s"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info"><?php echo $row["door_s"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">Opgang B</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_b"]; ?></td>
    <td class="info"><?php echo $row["skilt_b"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info"><?php echo $row["door_b"]; ?>&nbsp;</td>
  </tr><tr>
    <td height="25" class="sort_bar">Bar - Festrum</td>
    <td width="50" height="25" class="info"><?php echo $row["bar_lys"]; ?></td>
    <td class="info"><?php echo $row["bar_skilt"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info">&nbsp;</td>
  </tr
><tr>
    <td height="25" class="sort_bar">Opgang C</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_c"]; ?></td>
    <td class="info"><?php echo $row["skilt_c"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info"><?php echo $row["door_c"]; ?>&nbsp;</td>
  </tr
><tr>
    <td height="25" class="sort_bar">Opgang D</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_d"]; ?></td>
    <td class="info"><?php echo $row["skilt_d"]; ?></td>
    <td class="info">&nbsp;</td>
    <td class="info">&nbsp;</td>
      <td class="info"><?php echo $row["door_d"]; ?>&nbsp;</td>
  </tr>
  <tr>
    <td height="20" class="split">Etager</td>
    <td width="50"  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
      <td  class="split">&nbsp;</td>
  </tr>
  <tr>
    <td  class="grey_bar">1. Sal A</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_1"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_1"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_1"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_1"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">1. Sal B</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1b"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_1b"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_1b"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_1b"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_1b"]; ?></td>
  </tr>
  <tr>
    <td class="grey_bar">1. Sal C</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1c"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_1c"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_1c"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_1c"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_1c"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">1. Sal D</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_1d"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_1d"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_1d"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_1d"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_1d"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">2. Sal A</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_2"]; ?></td>
    <td class="info"><?php echo $row["skilt_2"]; ?></td>
  <td class="info"><?php echo $row["brand_t_2"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_2"]; ?></td>
      <td class="info"><?php echo $row["doors_2"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">2. Sal B</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_2b"]; ?></td>
    <td class="info"><?php echo $row["skilt_2b"]; ?></td>
  <td class="info"><?php echo $row["brand_t_2b"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_2b"]; ?></td>
      <td class="info"><?php echo $row["doors_2b"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">2. Sal C</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_2c"]; ?></td>
    <td class="info"><?php echo $row["skilt_2c"]; ?></td>
  <td class="info"><?php echo $row["brand_t_2c"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_2c"]; ?></td>
      <td class="info"><?php echo $row["doors_2c"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">2. Sal D</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_2d"]; ?></td>
    <td class="info"><?php echo $row["skilt_2d"]; ?></td>
  <td class="info"><?php echo $row["brand_t_2d"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_2d"]; ?></td>
      <td class="info"><?php echo $row["doors_2d"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">3. Sal A</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_3"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_3"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_3"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_3"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">3. Sal B</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3b"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_3b"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_3b"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_3b"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_3b"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">3. Sal C</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3c"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_3c"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_3c"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_3c"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_3c"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">3. Sal D</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_3d"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_3d"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_3d"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_3d"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_3d"]; ?></td>
  </tr>
  <tr>
    <td height="25" class="sort_bar">4. Sal A</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_4"]; ?></td>
    <td class="info"><?php echo $row["skilt_4"]; ?></td>
  <td class="info"><?php echo $row["brand_t_4"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_4"]; ?></td>
      <td class="info"><?php echo $row["doors_4"]; ?>&nbsp;</td>
  </tr
>
<tr>
    <td height="25" class="sort_bar">4. Sal B</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_4b"]; ?></td>
    <td class="info"><?php echo $row["skilt_4b"]; ?></td>
  <td class="info"><?php echo $row["brand_t_4b"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_4b"]; ?></td>
      <td class="info"><?php echo $row["doors_4b"]; ?>&nbsp;</td>
  </tr
>
<tr>
    <td height="25" class="sort_bar">4. Sal C</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_4c"]; ?></td>
    <td class="info"><?php echo $row["skilt_4c"]; ?></td>
  <td class="info"><?php echo $row["brand_t_4c"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_4c"]; ?></td>
      <td class="info"><?php echo $row["doors_4c"]; ?>&nbsp;</td>
  </tr
>
<tr>
    <td height="25" class="sort_bar">4. Sal D</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_4d"]; ?></td>
    <td class="info"><?php echo $row["skilt_4d"]; ?></td>
  <td class="info"><?php echo $row["brand_t_4d"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_4d"]; ?></td>
      <td class="info"><?php echo $row["doors_4d"]; ?>&nbsp;</td>
  </tr
>
<tr>
    <td  class="grey_bar">5. Sal A</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_5"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_5"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_5"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_5"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">5. Sal B</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5b"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_5b"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_5b"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_5b"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_5b"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">5. Sal C</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5c"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_5c"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_5c"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_5c"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_5c"]; ?></td>
  </tr>
  <tr>
    <td  class="grey_bar">5. Sal D</td>
    <td width="50" height="25" class="grey_bar" ><?php echo $row["lys_5d"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_5d"]; ?></td>
    <td class="grey_bar"><?php echo $row["brand_t_5d"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_5d"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_5d"]; ?></td>
  </tr>
<tr>
    <td height="25" class="sort_bar">6. Sal A</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_6"]; ?></td>
    <td class="info"><?php echo $row["skilt_6"]; ?></td>
  <td class="info"><?php echo $row["brand_t_6"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_6"]; ?></td>
      <td class="info"><?php echo $row["doors_6"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="sort_bar">6. Sal B</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_6b"]; ?></td>
    <td class="info"><?php echo $row["skilt_6b"]; ?></td>
  <td class="info"><?php echo $row["brand_t_6b"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_6b"]; ?></td>
      <td class="info"><?php echo $row["doors_6b"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="sort_bar">6. Sal C</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_6c"]; ?></td>
    <td class="info"><?php echo $row["skilt_6c"]; ?></td>
  <td class="info"><?php echo $row["brand_t_6c"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_6c"]; ?></td>
      <td class="info"><?php echo $row["doors_6c"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="sort_bar">6. Sal D</td>
    <td width="50" height="25" class="info"><?php echo $row["lys_6d"]; ?></td>
    <td class="info"><?php echo $row["skilt_6d"]; ?></td>
  <td class="info"><?php echo $row["brand_t_6d"]; ?></td>
    <td  class="info"><?php echo $row["brand_s_6d"]; ?></td>
      <td class="info"><?php echo $row["doors_6d"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="grey_bar">7. Sal A</td>
    <td width="50" height="25" class="grey_bar"><?php echo $row["lys_7"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_7"]; ?></td>
  <td class="grey_bar"><?php echo $row["brand_t_7"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_7"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_7"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="grey_bar">7. Sal B</td>
    <td width="50" height="25" class="grey_bar"><?php echo $row["lys_7b"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_7b"]; ?></td>
  <td class="grey_bar"><?php echo $row["brand_t_7b"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_7b"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_7b"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="grey_bar">7. Sal C</td>
    <td width="50" height="25" class="grey_bar"><?php echo $row["lys_7c"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_7c"]; ?></td>
  <td class="grey_bar"><?php echo $row["brand_t_7c"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_7c"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_7c"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="25" class="grey_bar">7. Sal D</td>
    <td width="50" height="25" class="grey_bar"><?php echo $row["lys_7d"]; ?></td>
    <td class="grey_bar"><?php echo $row["skilt_7d"]; ?></td>
  <td class="grey_bar"><?php echo $row["brand_t_7d"]; ?></td>
    <td  class="grey_bar"><?php echo $row["brand_s_7d"]; ?></td>
      <td class="grey_bar"><?php echo $row["doors_7d"]; ?>&nbsp;</td>
  </tr
  >
  <tr>
    <td height="20" class="split">Taget</td>
    <td width="50"  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
    <td  class="split">&nbsp;</td>
      <td  class="split">&nbsp;</td>
  </tr>
  <tr>
    <td height="14" class="sort_bar">Taget</td>
    <td width="50" height="25" class="info" ><?php echo $row["lys_t"]; ?></td>
    <td class="info"><?php echo $row["skilt_t"]; ?></td>
    <td class="info"></td>
    <td  class="info"><?php echo $row["brand_s_t"]; ?></td>
      <td class="info"><?php echo $row["door_t"]; ?></td>
  </tr>
  </table>
<br />
<?php } ?>
</body>
</html>
Avatar billede jakobdo Ekspert
28. april 2014 - 09:40 #9
Og så spørger jeg igen. De data du trækker ud, hvilken tabel kommer de fra? Er det alle dine tabeller der er brug ?
Avatar billede kane Juniormester
28. april 2014 - 09:43 #10
ja alle mine tabeller er i brug
Avatar billede jakobdo Ekspert
28. april 2014 - 10:17 #11
Det virker som en noget "dum" løsning. :o)

Men nej, jeg har ikke en ide om hvorfor din kode er langsom.
Avatar billede kane Juniormester
28. april 2014 - 10:19 #12
hvad er så ikke en "dum" løsning?
Avatar billede jakobdo Ekspert
28. april 2014 - 10:21 #13
En løsning uden 100 tabeller.
Men 100 tabeller kan sagtens være den rigtige løsning. Men lige pt virker det "forkert" :o)
Avatar billede kane Juniormester
28. april 2014 - 10:24 #14
kan jeg lave en mysql_query for hver ?
Avatar billede jakobdo Ekspert
28. april 2014 - 10:27 #15
Nej nej...
Men måske fortælle lidt om hvorfor du har 100 tabeller og hvad du gemmer i disse tabeller.
Avatar billede kane Juniormester
28. april 2014 - 10:38 #16
ja ok, det er en app til mit arbejde, hvor jeg går en brandrunde (checker, lys, døre, skilte, brand tæppe og brandsprøjte)

Der er 28 steder jeg skal checke, plus tag og underetage)

så har jeg lavet en tabel for hver sted, da der er forskellige steder og etager.
Avatar billede kane Juniormester
28. april 2014 - 10:41 #17
dem gemmer jeg så i en database, så jeg kan give opgaver videre om hvad der skal laves (lys skiftes, døre ordnes osv osv)
Avatar billede jakobdo Ekspert
28. april 2014 - 10:46 #18
Jeg ville jo nok lave det lidt anderledes.
F.eks. kunne hvert sted / ting nemt være en POST i en og samme tabel.

F.eks.:

Sted / Ting:

id - navn
1 - dør 1
2 - brandtæppe 1
3 - underetage
osv...

Så har du en "kontrolleret / check" tabel.

Kontrol / check:

id - sted/ting_id - tid for check
1 - 1 - 10:45:00 - 2014-04-28 (betyder dør 1 er tjekket og godkendt på angivne tidspunkt)
2 - 2 - 10:47:00 - 2014-04-28 (brandtæppe 1 kontrolleret angivne tidspunkt)
osv...
Avatar billede jakobdo Ekspert
28. april 2014 - 10:47 #19
Og ang. dine opgaver der skal gives videre. Der kunne du oprette en ekstra tabel.

Skal fikses eller lign...
id - sted_ting_id - kommentar - fikset eller hvor meget du ønsker...
1 - 1 - Dør lukker ikke automatisk - (0 / 1) for om den er fikset eller ej.
osv...
Avatar billede kane Juniormester
28. april 2014 - 10:53 #20
så færre tabeller med flere rækker er bedre end mange tabelle med få rækker
Avatar billede jakobdo Ekspert
28. april 2014 - 10:56 #21
Svært at sige med 100% sikkerhed. Men sådan ville jeg bygge det op ja.
Jeg ville aldrig lave en tabel pr ting/sted.
Avatar billede kane Juniormester
28. april 2014 - 21:20 #22
så er jeg ved at rette min kode.
Nu når jeg skal sætte flere ting ind i den samme tabel, af flere gange, går jeg efter dato.

Men den driller lidt.


if (isset($_POST['etDate']) {
   
      $etData = $_POST['etDate'];
   
    //initial query
    $query = "INSERT INTO under_etage ( lys_u_s, skilt_u_s, door_u_s ) VALUES ( :lys_u_s, :skilt_u_s, :door_u_s )  where etData = "$_POST[etData]" ";


    //Update query
    $query_params = array(
     
        ':lys_u_s' => $_POST['lys_u_s'],
        ':skilt_u_s' => $_POST['skilt_u_s'],
        ':door_u_s' => $_POST['door_u_s']
     
    );

den siger data bliver lagt i db, men der sker intet med lys_u_s osv osv
Avatar billede jakobdo Ekspert
29. april 2014 - 09:02 #23
Og du er sikker på $_POST indeholder data ?
Avatar billede kane Juniormester
29. april 2014 - 10:17 #24
ja den indeholder en dato 29.04.2014
Avatar billede jakobdo Ekspert
29. april 2014 - 10:27 #25
Den skal jo også indeholde dette:

':lys_u_s' => $_POST['lys_u_s'],
        ':skilt_u_s' => $_POST['skilt_u_s'],
        ':door_u_s' => $_POST['door_u_s']
Avatar billede kane Juniormester
29. april 2014 - 10:41 #26
altså de felter er i tabellen i mysql, men det er jo dem jeg skal opdatere med data
Avatar billede jakobdo Ekspert
29. april 2014 - 10:48 #27
kane: Jeg tror desværre snart jeg smider håndklædet i ringen... Det virker til vi snakker 2 helt forskellige sprog. :o)
Avatar billede kane Juniormester
29. april 2014 - 10:52 #28
heh ok np, tak for hjælpen ellers :)
Avatar billede jakobdo Ekspert
29. april 2014 - 10:57 #29
selv tak. :o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester