Re: While and echoing HTML
| From: | darren kirby | Date: | Tue, 10 May 2005 06:39:27 +0000 |
| Subject: | Re: While and echoing HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214816@lists.php.net to get a copy of this message | ||
quoth the Mark Sargent:
<snip>
> <html>
> <body>
> <h1><center>Jumbo Status</center></h1><br>
> <?php
> $db = mysql_connect("localhost", "root", "grunger");
> mysql_select_db("status",$db);
> $result = mysql_query("SELECT ProductTypes.product_type_detail FROM
> ProductTypes",$db);
> $myrow = mysql_fetch_array($result);
> $num = mysql_num_rows($result);
> ?>
> <table aligh="center" border="2">
> <tr>
> <td>Product Type</td>
> </tr>
> <?
> $i=0;
> while ($i < $num){
> $product_type=mysql_result($result,$i,"product_type_detail");
> echo "<tr><td><? echo $product_type ?></td></tr>"
You are already in a php block here. Why the '<?' ? Try:
echo "<tr><td>$product_type</td></tr>";
> }
> $i++
As the error message is trying to tell you, php statements are terminated with
semi-colons:
$i++;
> ?>
> </table>
> </body>
> </html>
>
> I get the folowing error,
>
> *Parse error*: parse error, unexpected '}', expecting ',' or ';'
> in
> */var/www/html/products.php* on line *20
> *
> which is the $i++ section.
>
> Cheers.
>
> Mark Sargent.
-d
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]