please correct this code what's wrong with it
Posted: Tue Mar 09, 2004 3:19 pm
hello all. I am trying to connect to Mysql with php(which i have done succesfully) but when i try to use same code in html embedded page it does not displays output correctly.
here is code
can you tell me what is wrong with this code. i get output as :
echo("Name is $name and sex is $sex");
echo("<br>");
}
MySQL_close();
"
Sincerely,
Anmol
here is code
Code: Select all
<html>
<head>
<title>Sentinel An Intrusion Detection Sysem<br><br></title>
</head>
<body>
<img src = "sentinel.jpg" alt = "Image 1">
<?php
$host = "localhost";
$login_name = "root";
$password = "brassman";
MySQL_connect("$host","$login_name","$password");
MySQL_select_db(narayan) or die("Failed");
$query = "SELECT * FROM pet";
$result = MYSQL_query($query);
While($rows = MySQL_fetch_array($result)){
$name=$rows['name'];
$sex=$rows['sex'];
echo"<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>";
echo("Name is $name and sex is $sex");
echo("<br>");
}
MySQL_close();
?>
</body>
</html>echo("Name is $name and sex is $sex");
echo("<br>");
}
MySQL_close();
"
Sincerely,
Anmol