dqv84329 2013-08-25 19:58
浏览 844
已采纳

您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在''leave'附近使用正确的语法

I always get this error when i run my code

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''leave'' at line 1

Here is my coding part

<?php
        $result = mysql_query("select * from 'leave'");
        if ($result == FALSE)
        {
            die(mysql_error());
        }
        while($row = mysql_fetch_assoc($result))
        {
    ?>
    <tr>
        <td><a href = "app_status.php? id = <?php echo $row["Leave_ID"];?>" target = "_blank"></a>Leave ID</td>
        <td><?php echo $row["Emp_ID"];?></td>   
        <td><?php echo $row["Date_Apply"];?></td>
        <td><?php echo $row["Leave_Type"];?></td>
        <td><?php echo $row["Leave_Start"];?></td>
        <td><?php echo $row["Leave_End"];?></td>
        <td><?php echo $row["Status"];?></td>
    </tr>
    <?php
        }

    ?>
  • 写回答

4条回答 默认 最新

  • drevls8138 2013-08-25 19:59
    关注

    Don't use single quaots

    You can try it as

     $result = mysql_query("select * from leave");
    

    Or use ` key

     $result = mysql_query("select * from `leave`");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏