Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $conn = new mysqli($servername, $username, $password, $dbname);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT id, data FROM table";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- echo "<table>";
- echo "<thead>";
- echo "<tr>";
- echo "<th>ID</th>";
- echo "<th>name</th>";
- echo "</thead>";
- echo "<tbody>";
- while($row = $result->fetch_assoc()) {
- echo "<tr>";
- echo "<td>".$row["id"]."</td>";
- $array = $row["data"];
- $array = json_decode($array);
- echo "<td>".$array[1]->value."</td>";
- }
- echo "</tbody>";
- echo "</table>";
- } else {
- echo "0 results";
- }
- $conn->close();
Advertisement
Add Comment
Please, Sign In to add comment