Also mache ich eine E-Commerce-Website für uni und alles war in Ordnung, bis ich tatsächlich versucht, die Website in Chrom zu sehen. Im Wesentlichen erzeuge ich eine Tabelle aus MySQL-Daten zurück an der Uni. Das Problem, das ich habe, ist über dem, wo der Tisch sein sollte. Entschuldigen Sie den Code, der ein Durcheinander ist. Ich bin dabei, Dinge hinzuzufügen.PHP Echo Probleme, falsche Anzeige
<?php $command='select * from products' ; $runCommand=m ysqli_query($connection, $command); if (mysqli_num_rows($runCommand)>0){ echo "
<form id=\ "shoppingcart\" action=\ "cart.php\" method=\ "post\">"; echo "
<table>"; echo "
<thead>"; echo "
<tr>"; echo "
<th scope=\ "col\">Image</th>"; echo "
<th scope=\ "col\">Item</th>"; echo "
<th scope=\ "col\">Qty</th>"; echo "
<th scope=\ "col\">UpdatedQty</th>"; echo "
<th scope=\ "col\">Price</th>"; echo "</tr>"; echo "</thead>"; while($ROWVARIABLE= mysqli_fetch_assoc($runCommand)) { //line BROKE goes here //need an if quantity=0 then don't print the bunch we have under here...// echo "
<tr>"; echo "
<td>
<img src='". $ROWVARIABLE["image"]. "' alt='". $ROWVARIABLE["decription"]. "' height='200' '</img></td>"; //this is still one line, don't flip shit. It 's the img with a hover over Decription
\t \t \t echo "<td>". $ROWVARIABLE["name"]. "</td>"; //Item
\t \t \t echo "<td>".newID[$ROWVARIABLE["ID"]]."</td>"; //Quantity
\t \t \t echo "<td><select name=\"updateQ\" id=\"updateQ\">"; //Updated Quantity
\t \t \t echo "<option selected=\"selected\">No change</option>";
\t \t \t echo "<option>1</option>";
\t \t \t echo "<option>2</option>";
\t \t \t echo "<option>3</option>";
\t \t \t echo "<option>4</option>";
\t \t \t echo "<option>5</option>";
\t \t \t echo "<option>6</option>";
\t \t \t echo "<option>7</option>";
\t \t \t echo "<option>8</option>";
\t \t \t echo "<option>9</option>";
\t \t \t echo "</select>";
\t \t \t echo "</td>";
\t \t \t //BROKE 2.0
\t \t \t // Gotta fix this ^^ line to display £Price of all units added(£Price of one unit)
\t \t \t
\t \t }
\t echo "</table>";
\t echo "</br>";
\t }
\t else{
\t \t echo "Table broken, pls stahp!";
\t }
\t ?>
Wenn Sie den Code ausführen Snippit es eine Reihe von Echos über dem Tisch wirft und ich habe keine Ahnung, warum oder wie man es beheben. Ich denke, das ist wahrscheinlich ein Anfängerfehler, aber ich bin wirklich in Panik geraten. Die Datei wird als .php
gespeichert und ich starte die Datei mit <!DOCTYPE html>
. Dies ist in der Nähe der Spitze meiner Datei
<?php $connection = mysqli_connect(the stuff I need to connect.); ?>
Dachte, dass relevant ist.
https://gyazo.com/0dd6a3d7b025133c5b061e6af06f1091
Ein Blick auf die farbliche Hervorhebung im Fragecode gibt einen schnellen visuellen Hinweis darauf, was falsch läuft. –
Der Screenshot sieht aus wie PHP nicht verarbeitet. Der Code hier scheint falsch formatiert zu sein. – chris85
Notepad ++ oder NetBeans wird Ihnen zeigen, wo die Fehler sind. – mitkosoft