Jump to content

php in html


jagguy

Recommended Posts

How do I embed php in html as this deosn't work, but it does work in a php script with no html in the same directory.

[code]

</head>
<body bgcolor="#ffffff"><?php $dbhost ="" 'localhost';

$conn = mysql_connect($dbhost,'root','') ;


$dbname = 'petstore';
mysql_select_db($dbname);


$query="select * from species";
$rt=mysql_query($query);

while($nt=mysql_fetch_array($rt))
{
echo "$nt[id] $nt[species] <br>";   
}


?>



</body>
</html>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/22731-php-in-html/
Share on other sites

you can use CSS, javascript or any other client side technology on them after they've been retrieved via PHP. keep in mind that the browser [i]only sees[/i] what PHP feeds it, so when you generate your markup, just output classes and IDs as you want them to be for your CSS layout.
Link to comment
https://forums.phpfreaks.com/topic/22731-php-in-html/#findComment-103003
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.