PHP display text from MYSQL -
i'm still vary new php coding.
i have code request , show numbers database cant seem figure out how show text. i've googled different phrases cant seam figure out.
i have following code: can see second statement in number format , works great, first statement need change show username rather numbers.
so instead of saying " . number_format((float)$row['0']) . " needs what? shows username tokens.
edit: added notation original code posted easier see did in final code.
/*begin username search*/ $result = mysqli_query($con,"select username authorize max(tokens)"); /*end username search*/ /*begin display of username*/ while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td class='pslc'>" . number_format((float)$row['0']) . "</td>"; } /*end display of username*/ /*begin search of tokens username*/ $result = mysqli_query($con,"select max(tokens) authorize"); /*end search of tokens username*/ /*begin display of tokens username*/ while($row = mysqli_fetch_array($result)) { echo "<td class='psrc'>" . number_format((float)$row['0'], 5, '.', '') . "</td>"; echo "</tr>"; } /*end display of tokens username*/ edit: here update of final code others can see did.
first edited " . number_format((float)$row['0'], 5, '.', '') . " " . $row['0'] . " change alone did not fix problem. after trial , error discovered needed make code request max(tokens). after requesting max(tokens) tell next search find username related provided amount of tokens found. display username , tokens on page.
/*begin username search*/ $result = mysqli_query($con,"select max(tokens) authorize"); while($row = mysqli_fetch_array($result)) { $maxtokenusername=("select username authorize tokens = '" . $row['0'] . "'"); } /*end username search*/ /*begin display of username*/ $result = mysqli_query($con,$maxtokenusername); while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td class='pslc'><center>" . $row['0'] . "</center></td>"; } /*end display of username*/ /*begin search of tokens username*/ $maxtokens=("select max(tokens) authorize"); /*end search of tokens username*/ /*begin display of tokens username*/ $result = mysqli_query($con,$maxtokens); while($row = mysqli_fetch_array($result)) { echo "<td class='psrc'>" . number_format((float)$row['0'], 5, '.', '') . "</td>"; echo "</tr>"; } /*end display of tokens username*/
remove part number_format((float)) code put
echo "<td class='pslc'>" .$row['0']. "</td>";
Comments
Post a Comment