Is this an acceptable way of writing PHP code(in scriptlets) Is this the way PHP developers write PHP or is echoing the html the preferred method?

&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php

require_once 'db_connect.php';
session_start();

$result = mysql_query("SELECT * FROM products");
?&gt;

&lt;table border=1&gt;
    &lt;th&gt;
    Product ID
    &lt;/th&gt;
    &lt;th&gt;
    Name
    &lt;/th&gt;
    &lt;th&gt;
    Description
    &lt;/th&gt;
    &lt;th&gt;
    Price
    &lt;/th&gt;
    &lt;th&gt;
    Image
    &lt;/th&gt;
    &lt;th colspan=2&gt;
    Action
    &lt;/th&gt;
&lt;?php
while($row = mysql_fetch_array($result))
{
    ?&gt;
    &lt;tr&gt;
        &lt;td&gt;
            &lt;?php
                echo $row['p_id'];
            ?&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;?php
                echo $row['p_name'];
            ?&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;?php
                echo $row['p_description'];
            ?&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;?php
                echo $row['p_price'];
            ?&gt;
        &lt;/td&gt;
        &lt;td&gt;
            &lt;?php
                echo $row['p_image_path'];
            ?&gt;
        &lt;/td&gt;
        &lt;td&gt;
            edit
        &lt;/td&gt;
        &lt;td&gt;
            delete
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;?php
}
?&gt;


&lt;/table&gt;



&lt;/body&gt;
&lt;/html&gt;
A few points: 

Put the session_start() and as much of processing as possible on top of the file, before any output. This will be useful for emitting http-headers.

When using a database: don't forget to handle exceptions.

When using a database: don't forget to handle  charsets. 

When selecting from the database: always limit your results. Add pagination of some kind.

Do not use mysql_*, use a db library that offers prepared statements and is as db-independent as possible. I would recommend PDO.  I would also recommend getting the data from the db as objects. If necessary you can define a class to hold some methods you need for these objects.

I cuncur with Cygal: using php as the templating language is quite ok.  See Wordpress for an example where this is used extensively in themes.

Try to write your HTML in a compact, readable way. No matter what you use for templating: HTML is an important part of your code, and should be just as readable as any other code you write.

Output valid HTML. Don't forget question marks around attribute values, don't forget -Tags. 

   &lt;?php

      session_start();
      include "config.php";
      if( ! $DB_NAME ) die('please create config.php, define $DB_NAME, $DB_USER, $DB_PASS there');

      try {

          $dbh = new PDO("mysql:dbname=$DB_NAME", $DB_USER, $DB_PASS);
          $dbh-&gt;exec('SET CHARACTER SET utf8') ;

          $result = $dbh-&gt;query("SELECT * FROM products LIMIT 0,20");
          $products = $result-&gt;fetchAll(PDO::FETCH_OBJ);

      } catch( Exception $e ) {

          error_log( $e-&gt;getMessage() . " ".  $e-&gt;getTraceAsString() );
          include("500-failwhale.php");
          exit;
      }
    ?&gt;

    &lt;!DOCTYPE html&gt;
    &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Products&lt;/title&gt;
      &lt;meta charset="utf-8"&gt;
    &lt;/head&gt;
    &lt;body&gt;

    &lt;table class="with_border"&gt;
        &lt;tr&gt;
            &lt;th&gt;Product ID  &lt;/th&gt; 
            &lt;th&gt;Name        &lt;/th&gt; 
            &lt;th&gt;Description &lt;/th&gt; 
            &lt;th&gt;Price       &lt;/th&gt; 
            &lt;th&gt;Image       &lt;/th&gt; 
            &lt;th colspan="2"&gt; Action  &lt;/th&gt; 
        &lt;/tr&gt;
    &lt;?php foreach($products as $p) : ?&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;?= $p-&gt;p_id          ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?= $p-&gt;p_name        ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?= $p-&gt;p_description ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?= $p-&gt;p_price       ?&gt;&lt;/td&gt;
            &lt;td&gt;&lt;?php if ( $p-&gt;p_image_path ) : ?&gt;
                   &lt;img src="&lt;?= $p-&gt;p_image_path ?&gt;" alt="&lt;?= $p-&gt;p_name ?&gt;"&gt;
            &lt;?php endif; ?&gt;&lt;/td&gt;
            &lt;td&gt;edit&lt;/td&gt;
            &lt;td&gt;delete&lt;/td&gt;
        &lt;/tr&gt;
    &lt;?php endforeach; ?&gt;

    &lt;/table&gt;

    &lt;/body&gt;
    &lt;/html&gt;