1-33
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Symfony2 – Franz Jordán 2011<br />
$link = mysql_connect('localhost', 'myuser', 'mypassword');<br />
mysql_select_db('blog_db', $link);<br />
$result = mysql_query('SELECT id, title FROM post', $link);<br />
$posts = array();<br />
while ($row = mysql_fetch_assoc($result)) {<br />
$posts[] = $row;<br />
}<br />
mysql_close($link);<br />
// include the HTML presentation code<br />
require 'templates/list.php';<br />
The HTML code is now stored in a separate file (templates/list.php), which is primarily an<br />
HTML file that uses a template-like PHP syntax:<br />
<br />
<br />
List of Posts<br />
<br />
<br />
List of Posts<br />
<br />
<br />
<br />
13