sorry to distrube you agian n again n again .but yet my problem is not solved.
i put the code given by you in ur last reply .and i changed the detabase variables accordingly.when i put these code in my php page and pointed my browser to to this.
i got this parse error .
Parse error: parse error, unexpected ';' in
D:\wwwroot\faq\index.php on line 8..
however i was able to solve this error by my own ..
acctully the error was caused by misstyping in line 8
echo "<table">;
and then i changed this to
echo "<table>";
after making changes . i retried and poined my browser to this page .
but even this time i was dissopointed . there was an other error on line 12..
and this time .i could not solve the error ..
this was the error .
Parse error: parse error, unexpected T_VARIABLE, expecting '(' in
D:\wwwroot\faq\index.php on line 12 ..
after making neccesory changes the code looked like Bellow - <?php
-
$conn = mysql_connect("localhost", "root", "mypass")
-
or die("Cannot connect to server: " . mysql_error());
-
mysql_select_db("faq")
-
or die("Cannot select database: " . mysql_error());
-
$res = mysql_query("SELECT * FROM category")
-
or die("Select errro: " . mysql_error());
-
echo "<table>";
-
$i = 0;
-
while ($row = mysql_fetch_assoc($res)) {
-
$i++;
-
switch $i {
-
case 1 : echo "<tr><td>{$row['Id']}</td><td>{$row['name']}</td>";
-
break;
-
case 2 : echo "<td>{$row['Id']}</td><td>{$row['name']}</td>";
-
break;
-
case 3 : echo "<td>{$row['Id']}</td><td>{$row['name']}</td></tr>";
-
$i=0;
-
break;
-
}
-
}
-
if ($i < 3)
-
echo "</tr>";
-
echo "</table>";
-
?>