$res1 = mysql_query($sql1); if($line1 = mysql_fetch_array($res1,MYSQL_ASSOC)) { $sum1 = (int)$num * (int)$line1['price']; $sum+=$sum1; AddXlsOrderLine($line1['title'],$num,$line1['price'],$sum1); } } $resarr[$resarrc++][3] = $sum; } //print_r($resarr); $s = generateHTML($resarr); //XLSHeader("testfile"); echo $s;
{ return '<head><title>' . $title . '</title></head>'; } /** * Generate the <body> section of the HTML file. * * @param string $title The page's title * @param string $text The paragraph's text. * @return string Formatted HTML <body> section */ function generateBody($title, $text) { return '<h1>' . $title . '</h1>' . "\n" . '<p>' . $text . '</p>'; } /** * Put all the other functions together to produce a full * HTML page. * * @param string $title The document's title * @param string $content The main content for the page * @return string Full formatted HTML page */ function generateHTML($title = 'Default Title', $content = 'Default Content') { $head = generateHeader($title); $body = generateBody($title, $content); return '<html>' . $head . $body . '</html>'; } // Main $content = generateHTML('Page Title!'); print $content;
<?php require_once 'rottenTomatoes.php'; require_once 'html.php'; $movies = queryUpcomingMovies(); $html = generateHTML($movies); echo $html;