php code entering my html -


i'm trying insert data php page mysql databse. when refresh page parts of php code being displayed on page rather being processed below code(sensitive info blocked):

<?php   $servername = "localhost";   $username = "*******";   $password = "*******";   $dbname = "accounts";    // create connection   $conn = mysqli_connect($servername, $username, $password, $dbname);   // check connection   if (!$conn) {       die("connection failed: " . mysqli_connect_error());   }    $sql = "insert myguests (firstname, lastname, email)   values ('john', 'doe', 'john@example.com')";    if (mysqli_query($conn, $sql)) {   echo "new record created successfully";   } else {      echo "error: " . $sql . "<br>" . mysqli_error($conn);   }    mysqli_close($conn); ?> 

and screenshot of "view source", can see sort of stops doing it's php , displaying page. thoughts?

view source

hello bro code alright test on local server. think not saving file correct extension. or mysql table fields incorrect if data not inserting. correct extension php file name.php


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -