-3

I am trying to embed php in css but the result is not as required it is showing me the variable names and an echo statement:-

<!doctype html>
<?php
require_once("mysqlconnect.php");
session_start();
$q="select * from profile where mobile=8078899386";
?>

<html>
<head></head>
<body>
    <div>
    <?php
        $result=mysqli_query($conn,$q);
        $field=mysqli_fetch_field($result);
        echo "<p>$result</p>";
        echo "<p>$field</p>";
    ?>
    </div>
</body>
</html>

Result is:

$result
"; echo "
$field

"; ?>
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
katty
  • 173
  • 1
  • 8

2 Answers2

2

Try to change like below

 echo "<p>".$result."</p>";
 echo "<p>".$field."</p>";
Alive to die - Anant
  • 70,531
  • 10
  • 51
  • 98
Shibon
  • 1,552
  • 2
  • 9
  • 20
2

PHP is a server-side scripting language, so you have to save the file with the php extension (e.g. filename.php) and the script has to be executed from the server-side. Your output comes from the client-side (i.e. HTML output).

Sᴀᴍ Onᴇᴌᴀ
  • 8,218
  • 8
  • 36
  • 58