html - Can a table run in a php while loop? -


i attempting create table pulls data database via query, can not table display whatsoever when put inside while loop need data. doing wrong code or not possible thing? post both css , html edit 2: calculations variables such $diff

$str5npos = ($str5npos /100); $str5npos = $str5npos +12.015; $str5nposgraph = (($str5npos/40) *100);  $str5spos = ($str5spos /100); $str5spos = $str5spos +12.015; $str5sposgraph = (($str5spos/40) *100); $total5= round($str5npos + $str5spos);   $diff5 = round($str5npos - $str5spos); $direction5 = 'north'; if ($diff5 < 0) {     $direction5 = 'south'; }  

edit: here query

$result = mysql_query("select * p4updates db4primekey = 4");  // fetch live values data base while($row = mysql_fetch_array($result))     {     $str1npos = $row['str1npos'];$str1spos = $row['str1spos'];$str2npos = $row['str2npos'];$str2spos = $row['str2spos'];$str3npos = $row['str3npos'];     $str3spos = $row['str3spos'];$str4npos = $row['str4npos'];$str4spos = $row['str4spos']; $str5npos = $row['str5npos'];     $str5spos = $row['str5spos'];$str6npos = $row['str6npos'];$str6spos = $row['str6spos'];$str7npos = $row['str7npos'];     $str7spos = $row['str7spos'];$wrnpos = $row['wrnpos'];$wrspos = $row['wrspos'];      $strout1 = $row['strout1'];$strout2 = $row['strout2'];$strout3 = $row['strout3'];$strout4 = $row['strout4'];$strout5 = $row['strout5'];     $strout6 = $row['strout6'];$strout7 = $row['strout7'];$wrout4 = $row['wrout4'];      $strfbk1 = $row['strfbk1'];$strfbk2 = $row['strfbk2'];$strfbk3 = $row['strfbk3'];$strfbk4 = $row['strfbk4'];$strfbk5 = $row['strfbk5'];     $strfbk6 = $row['strfbk6'];$strfbk7 = $row['strfbk7'];$wrfbk3 = $row['wrfbk3'];      $stralm1 = $row['stralm1'];$stralm2 = $row['stralm2'];$stralm3 = $row['stralm3'];$stralm4 = $row['stralm4'];$stralm5 = $row['stralm5'];       } 

css

.maintable { float: left;width:100%;  background-color:#cef7ce;border-collapse:collapse;  font-size: 20px; } .maintable th { background-color:#197d19;color:white; font-size: 15px; } .maintable td, .maintable th {  padding:1px;border:1px solid #000; font-size: 20px; } 

html

  <col width="10%">   <col width="9%">   <col width="9%">   <col width="9%">   <col width="9%">   <col width="9%">   <col width="9%">   <col width="9%">   <col width="9%">   <tr>       <?php while($row = mysql_fetch_array($result)) {    // row 1 entrys   echo "<td height ='54' align='center'>" . $diff1= row['diff1'].''. $direction1 = row['direction1']. "</td>" ; echo "<td height ='54' align='center'>" . $diff2 = row['diff2'] .''.$direction2 = row['direction2']. "</td>"; echo "<td height ='54' align='center'>" . $diff3= row['diff3'] .''.$direction3= row['direction3'] . "</td>";  echo "<td height ='54' align='center'>" . $wrdiff= row['wrdiff'] .''.$wrdirection= row['wrdirection'] . "</td>";  echo "<td height ='54' align='center'>" . $diff4= row['diff4'].''. $direction4= row['direction4'] . "</td>"; echo "<td height ='54' align='center'>" . $diff5= row['diff5'] .''.$direction5= row['direction5']  ."</td>";  echo "<td height ='54' align='center'>" . $diff6= row['diff6'] .''.$direction6= row['direction6'] ."</td>";  echo "<td height ='54' align='center'>" . $diff7= row['diff7'].''. $direction7= row['direction7'] .  "</td>";  } ?> </tr>    <!-- row 2 entrys -->  <tr> <?php while($row = mysql_fetch_array($result)) {     echo "<td height ='54' align='center'>" .$strout1= row['strout1'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $strout2= row['strout2']. '%'."</td>"; echo "<td height ='54' align='center'>"  .$strout3= row['strout3'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $wrout4= row['wrout4']. '%'."</td>"; echo "<td height ='54' align='center'>" .$strout4= row['strout4'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $strout5= row['strout5'] .'%'."</td>"; echo "<td height ='54' align='center'>"  .$strout6= row['strout6']. '%'."</td>"; echo "<td height ='54' align='center'>"  .$strout7= row['strout7'] .'%'."</td>"; } ?> </tr> <!-- row 3 entrys --> <tr><?php while($row = mysql_fetch_array($result)) {    echo "<td height ='54' align='center'>". $strfbk1= row['strfbk1']. '%'."</td>"; echo "<td height ='54' align='center'>" . $strfbk2= row['strfbk2']. '%'."</td>"; echo "<td height ='54' align='center'>" . $strfbk3= row['strfbk3']. '%'."</td>"; echo "<td height ='54' align='center'>" . $wrfbk3= row['wrfbk3']. '%'."</td>"; echo "<td height ='54' align='center'>". $strfbk4= row['strfbk4'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $strfbk5= row['strfbk5']. '%'."</td>"; echo "<td height ='54' align='center'>" . $strfbk6= row['strfbk6']. '%'."</td>"; echo "<td height ='54' align='center'>" . $strfbk7= row['strfbk7']. '%'."</td>"; } ?>  </tr> <!--  row 4 entrys --> <tr><?php while($row = mysql_fetch_array($result)) {     echo "<td height ='54' align='center'>". $stralm1= row['stralm1']. '%'."</td>"; echo "<td height ='54' align='center'>" . $stralm2= row['stralm2'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $stralm3= row['stralm3']. '%'."</td>"; echo "<td height ='54' align='center'>" . '---'."</td>"; echo "<td height ='54' align='center'>". $stralm4= row['stralm4'] .'%'."</td>"; echo "<td height ='54' align='center'>" . $stralm5= row['stralm5'] .'%'."</td>"; echo "<td height ='54' align='center'>" . '---'."</td>"; echo "<td height ='54' align='center'>" . '---'."</td>"; } ?>  </tr>  </tr> </table> 

try inside loop. (i'm assuming have rows specific names in table. if not, remove number $row['direction'] , let loop grab each variable.)

edit: removed variable definition overwriting , redefining doing above. can see, $diff variables not coming database above being calculated off of other variables database. assuming these calculated , there's no error in piece, try below (using example provided above). note, not want use row if variables not coming row.

echo '<td height ="54" align="center">' . $diff5.' '. $direction5. '</td>' ; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

node.js - How to abort query on demand using Neo4j drivers -