php - Display data from mysql/phpmyadmin on html page -


i'm beginner in php. have tried put php in html file in order call data database called test , table called myemployee.
tried recommendation other forum still did not display in table, instead, code displayed.
following code. there wrong in code?

even if put in php file , then, call html file <?php include ('test.php')?> still didn't work.

<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>home</title> <link href="style/index-layout.css" rel="stylesheet" type="text/css" /> <link href="style/homepage-layout.css" rel="stylesheet" type="text/css"/> </head>  <body>  <!--right--> <div id="body"> <div id="left">  <br /><br /> <p ><b><h3>progress</h3></font></b></p>  </div></div> <?php       $username = "root";       $password = "";       $host = "localhost";        $connector = mysql_connect($host,$username,$password)           or die("unable connect");         echo "connections made successfully::";       $selected = mysql_select_db("test", $connector)         or die("unable connect");        //execute sql query , return records       $result = mysql_query("select * myemployee");       ?> <table>       <thead>         <tr>           <th>employee_id</th>           <th>employee_name</th>           <th>employee_dob</th>           <th>employee_adress</th>           <th>employee_dept</th>           <th>employee_salary</th>         </tr>       </thead>       <tbody>         <?php           while( $row = mysql_fetch_assoc( $result ) ){             echo "$row";             echo             "<tr>               <td>{$row['employee_id']}</td>               <td>{$row['employee_name']}</td>               <td>{$row['employee_dob']}</td>               <td>{$row['employee_addr']}</td>               <td>{$row['employee_dept']}</td>               <td>{$row['employee_sal']}</td>              </tr>";           }         ?>       </tbody>     </table>      <?php mysql_close($connector); ?> <br/><br/>  </body> </html> 

check file extensions. php (by default) can run in files .php extension.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -