Hi,
Its me again! well I got my last problem sorted and am now rattling through this PHP but I've hit a strange problem. I know that you experienced people will spot it straight away but its got me lost!
Im getting:
Parse error: parse error, unexpected '/' in /home/peasepu/public_html/newads.php on line 21
heres my code, the idea is to create a table 3 columns wide with whatever it finds ie
Title Title Title
Text Text Text
Name Name Name
Comment Comment Comment
so heres my code: (I've marked line 21 in red)
I tried having:
echo "<table><tr>"; before the while statement but hit problems there so I put them after the <body>. I've checked for missing ; etc but cant see anything wrong. All I can imagine is that its seeing the </td> on the first pass and thinks "I havent opened a <td> yet"
Thanks again in advance.
Peter
Its me again! well I got my last problem sorted and am now rattling through this PHP but I've hit a strange problem. I know that you experienced people will spot it straight away but its got me lost!
Im getting:
Parse error: parse error, unexpected '/' in /home/peasepu/public_html/newads.php on line 21
heres my code, the idea is to create a table 3 columns wide with whatever it finds ie
Title Title Title
Text Text Text
Name Name Name
Comment Comment Comment
so heres my code: (I've marked line 21 in red)
Code:
<body>
<table><tr>
<?php
$dbh=mysql_connect ("localhost","*****","*****") or die ('I cannot connect to the database because: ' . mysql_error());
$sel=mysql_select_db ('peasepu_whowhere',$dbh) or die ('I cannot connect to the database because: ' . mysql_error());
$query="SELECT * FROM `alreetads`;
$result=mysql_query($query) or die ('Query error: ' . mysql_error());
$num=mysql_numrows($result);
$i=0;
$col=1;
while ($i < $num) {
if ($col == 4) {
[COLOR=red]echo "</td></tr><tr><td>";[/color]
$col = 1;
}
else {
echo "<td>";
}
$title=mysql_result($result,$i,"title");
$text=mysql_result($result,$i,"text");
$name=mysql_result($result,$i,"name");
$contact=mysql_result($result,$i,"contact");
echo "$title<br>$text<br>$name<br>$contact</td>";
$col++;
$i++;
}
?>
</td></tr>
</table>
</body>
</html>
I tried having:
echo "<table><tr>"; before the while statement but hit problems there so I put them after the <body>. I've checked for missing ; etc but cant see anything wrong. All I can imagine is that its seeing the </td> on the first pass and thinks "I havent opened a <td> yet"
Thanks again in advance.
Peter