jagguy Posted October 2, 2006 Share Posted October 2, 2006 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] Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 2, 2006 Share Posted October 2, 2006 ... and why doesn't that work? are you naming the page a .php file? what error are you getting? Quote Link to comment Share on other sites More sharing options...
Jenk Posted October 2, 2006 Share Posted October 2, 2006 [code]<?php $dbhost ="" 'localhost';[/code]should be:[code]<?php $dbhost ='localhost';[/code] Quote Link to comment Share on other sites More sharing options...
jagguy Posted October 3, 2006 Author Share Posted October 3, 2006 HiOk I had an error on the php code I have been told, so now it works thanks.I suppose the question is how can you format the values I get from mysql on the webpage. Csn I use css on them somehow or do i need to use php only. Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 3, 2006 Share Posted October 3, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.