Hi everyone,
i have a question from my problem, is it possible to connect a PHP file which contain MySQL script into HTML file? if yes, does the connection really works? in example, i’m trying to send the form data from HTML into database by using PHP as a bridge for the two of it. from many of examples that i have search, there is almost no examples like the problem that i had, most of it recommends to use PHP file from scratch instead of HTML-PHP connection file.
My code goes with something like this
<?php
$db = mysqli_connect('localhost','root',' ','kantor');
?>
<html>
<body>
<?php
$query = "SELECT * FROM `form`;";
$result = mysqli_query($db, $query);
while($row = mysqli_fetch_assoc($result))
{
}
?>
</body>
</html>
Sorry if it’s sounds kind of silly, but i really confused about it because i prefer if i can do it by using HTML and PHP rather than going all PHP for both of the Front-end and Back-end. Thank you very much for reading and your time.