Hi All,
I've just started trying to teach myself php. I've come across a problem where 'echo' does not seem to stop at the semi-colon i.e.
Code:
<?php
$username="root";
$password="*********";
$database="testdb";
mysql_connect(pandaemonium,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query = "SELECT title FROM page WHERE ref = 1";
$result = mysql_query($query);
mysql_close();
echo "<h2>$result</h2>";
?>
is displayed in the browser as:
"$result"; ?>"
The predeclared css for h2 does not appear to have any effect on it. Do I need a '?php h2:' css entry?
Also, If I view source in firefox it shows the full php - including my MySQL password - I was not expecting that. Has the php been executed at all?
In MySQL the query correctly returns a string. This is what I want displayed.
Any tips would be appreciated.
Thanks,
Chris.