<body>
<div id=director>
<ul>
<?
$link=mysql_connect('localhost','root','552125')or die('Could not connect:'.mysql_error());
mysql_select_db('matv')or die ('Could not select database');
$level='SELECT count(*) AS 'theName' FROM ma_category where CategoryLevel=1 ';
$result=mysql_query($level);
$row=mysql_fetch_array($result);
$thename=$row['theName'];
while($line=mysql_fetch_array($result,MYSQL_ASSOC))
    {
  echo "<li>";
  foreach($line as $col_CategoryName)
  {
    echo "<div class=menu_top><a target="_self" class="menu_a" href=" ">.$col_CategoryName</a></div>";
      }
  echo"</li>"
}
mysql_free_result($result);
mysql_close($link);
?>
</body>
Parse error: syntax error, unexpected T_STRING in D:\Apache2.2\htdocs\sql\daohang.php on line 22  这是报错红色为错误行
希望帮忙看下

解决方案 »

  1.   

    谢楼上  
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\Apache2.2\htdocs\sql\daohang.php on line 32
    echo "<div class=menu_top><a target="_self" class="menu_a" href=" ">.$col_CategoryName</a></div>";
    这里还有问题  - -!求解  
      

  2.   


     echo "<div class=menu_top><a target='_self' class='menu_a' href=''>".$col_CategoryName."</a></div>";
      

  3.   

    $level='SELECT count(*) AS `theName` FROM ma_category where CategoryLevel=1';
    SQL语句中一般应该给数据库名、表名、字段名加上反勾号(键盘Tab键上面一排最左边一颗键),特别是字段名为SQL保留字的时候,必须加上。
      

  4.   

    谢谢   之前的都搞定了  最后一个报错了
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in D:\Apache2.2\htdocs\sql\daohang.php on line 20
    Could not connect:Access denied for user 'root'@'localhost' (using password: YES)我的连接有问题?mysql_connect(里面有三个值  最后一个是密码 前两个是什么?我没有理解清楚)
      

  5.   

    $level='SELECT count(*) AS theName FROM ma_category where CategoryLevel=1 ';echo "<div class=menu_top><a target='_self' class='menu_a' href=' '>$col_CategoryName</a></div>";另外,你要 foreach($line as $col_CategoryName) 干什么?
      

  6.   

    我想做动态的导航菜单  视频点播的
     我在取得一级分类后   我想拿到那些数据  每拿到一个 建立一个div  这样做导航菜单  我看的php手册这样做的  照猫画虎   我觉得while和foreach貌似重复了 但是不知道怎么改  能帮忙写个么?
      

  7.   

    你这是php字符串语法结构错误