PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Bundesliga Tippspiel
Beitrag
<blockquote data-quote="r3nt5ch3r" data-source="post: 997164" data-attributes="member: 21544"><p><strong>AW: Bundesliga Tippspiel</strong></p><p></p><p>Hab ich jetzt richtig verstanden, dass es am Ende so aussehen soll:</p><p>Also Username ganz links einmal, daneben dann jeweiligen Paarungen, auf die der User getippt hat?!</p><p></p><p>[code]<table></p><p><tr></p><p> <th>Name:</th></p><p> <th>Paarung 1 - Heimmannschaft</th></p><p> <th>Paarung 1 - Gastmannschaft</th></p><p> <th>Paarung 2 - Heimmannschaft</th></p><p> <th>Paarung 2 - Gastmannschaft</th></p><p></tr></p><p><tr></p><p> <td>username</td></p><p> <td>tipp 1 heim</td></p><p> <td>tipp 1 gast</td></p><p> <td>tipp 2 heim</td></p><p> <td>tipp 2 gast</td></p><p></tr></p><p><tr></p><p> <td>username 2</td></p><p> <td>tipp 1 heim</td></p><p> <td>tipp 1 gast</td></p><p> <td>tipp 2 heim</td></p><p> <td>tipp 2 gast</td></p><p></tr></p><p></table>[/code]Vorschlag:</p><p>[php]<?</p><p> $query = 'SELECT heim, gast, spiel_id FROM spieltag WHERE spieltag = 1';</p><p> $cols = array();</p><p> if ($result = mysql_query($query))</p><p> while ($row = mysql_fetch_assoc($result))</p><p> array_push($cols, $row);</p><p> </p><p> echo '<table><tr>';</p><p> echo '<th>User</th>';</p><p> foreach($cols as $col)</p><p> echo '<th>'.$col['heim'].' vs. '.$col['gast'].'</th>';</p><p> echo '</tr>';</p><p> </p><p> </p><p> $query = 'SELECT user.name as name, tipph, tippg, spieltag.spiel_id</p><p> FROM tipps</p><p> LEFT JOIN user ON tipps.tipper_id = user.id</p><p> LEFT JOIN spieltag ON tipps.spiel_id = spieltag.spiel_id</p><p> WHERE spieltag.spieltag = 1';</p><p> if($result = mysql_query($query)) {</p><p> while ($row = mysql_fetch_assoc($result)) {</p><p> echo '<tr>';</p><p> echo '<td>'.$row['name'].'</td>';</p><p> foreach ($cols as $col) {</p><p> if($row['spiel_id'] == $col['spiel_id']){</p><p> echo '<td>'.$row['tipph'].' - '.$row['tippg'].'</td>';</p><p> }else{</p><p> echo '<td>-</td>';</p><p> }</p><p> }</p><p> echo '</tr>';</p><p> }</p><p> echo '</table>';</p><p> } </p><p>?> [/php]Ausgabe:</p><p></p><p></p><p>€: hab die Tipps mit tipper_id = 0 mal weggelassen^^</p></blockquote><p></p>
[QUOTE="r3nt5ch3r, post: 997164, member: 21544"] [b]AW: Bundesliga Tippspiel[/b] Hab ich jetzt richtig verstanden, dass es am Ende so aussehen soll: Also Username ganz links einmal, daneben dann jeweiligen Paarungen, auf die der User getippt hat?! [code]<table> <tr> <th>Name:</th> <th>Paarung 1 - Heimmannschaft</th> <th>Paarung 1 - Gastmannschaft</th> <th>Paarung 2 - Heimmannschaft</th> <th>Paarung 2 - Gastmannschaft</th> </tr> <tr> <td>username</td> <td>tipp 1 heim</td> <td>tipp 1 gast</td> <td>tipp 2 heim</td> <td>tipp 2 gast</td> </tr> <tr> <td>username 2</td> <td>tipp 1 heim</td> <td>tipp 1 gast</td> <td>tipp 2 heim</td> <td>tipp 2 gast</td> </tr> </table>[/code]Vorschlag: [php]<? $query = 'SELECT heim, gast, spiel_id FROM spieltag WHERE spieltag = 1'; $cols = array(); if ($result = mysql_query($query)) while ($row = mysql_fetch_assoc($result)) array_push($cols, $row); echo '<table><tr>'; echo '<th>User</th>'; foreach($cols as $col) echo '<th>'.$col['heim'].' vs. '.$col['gast'].'</th>'; echo '</tr>'; $query = 'SELECT user.name as name, tipph, tippg, spieltag.spiel_id FROM tipps LEFT JOIN user ON tipps.tipper_id = user.id LEFT JOIN spieltag ON tipps.spiel_id = spieltag.spiel_id WHERE spieltag.spieltag = 1'; if($result = mysql_query($query)) { while ($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td>'.$row['name'].'</td>'; foreach ($cols as $col) { if($row['spiel_id'] == $col['spiel_id']){ echo '<td>'.$row['tipph'].' - '.$row['tippg'].'</td>'; }else{ echo '<td>-</td>'; } } echo '</tr>'; } echo '</table>'; } ?> [/php]Ausgabe: €: hab die Tipps mit tipper_id = 0 mal weggelassen^^ [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
PHP, Javascript, jQuery, Ajax, nodeJS, MySQL...
Bundesliga Tippspiel
Oben