Ciprian Tothãzan Ciprian Tothãzan - 3 months ago 10
SQL Question

Create a div on my website that shows database information with php

I need to create a div that only shows the information of the database, how should i connect the div to mysql so it only shows my database information?


I'm not sure I'm understanding your question... but I'll give it a try. The code below this will select whatever you tell it to from the database and echo it into a table.

$db = mysqli_connect('host', 'username', 'password', 'database');
$sql = "SELECT * FROM database"

mysqli_stmt_bind_param($db, "params here", your info here);
$res = mysqli_stmt_execute($sql);

echo "<table>";

while($row = mysqli_fetch_array($res)){   //Creates a loop to loop through results
    echo "<tr><td>" . $row[''] . "</td><td>" . $row[''] . "</td></tr>";  //$row['index'] the index here is a field name

echo "</table>";