您的SQL语法有误;检查与您的MySQL对应的手册 [英] You have an error in your SQL syntax; check the manual that corresponds to your MySQL

查看:204
本文介绍了您的SQL语法有误;检查与您的MySQL对应的手册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我的项目有误
此错误来自

hi
I have error in my project
this error comes

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 '''' at line 1



什么时候
我在aa.php中列出了一个列表
然后在advisor.php中获取sID

内2个文件
首先:aa.php



when
I make a list in aa.php
then get sID in advisor.php

inside 2 files
first: aa.php

        $db_name="coop";
        $tbl_name="students";
        mysql_connect("localhost", "root", "");
        mysql_select_db("$db_name");
        session_start();
$tID=$_SESSION['tID'];
        $sql=mysql_query("SELECT * FROM $tbl_name WHERE advisor=$tID") or die(mysql_error());
        while($mysqlf =mysql_fetch_array($sql))
        {
            $student=$mysqlf['sname'];
            //echo "$student &nbsp&nbsp&nbsp";
            $sid=$mysqlf['sID'];
            //echo"$sid<br>";
            echo "<center></font><a href='advisor.php?students=$student'>".$mysqlf['sname']."</a>&nbsp;&nbsp;&nbsp;&nbsp;".$mysqlf['sID']."</label>";
        }?>



第二个:advisor.php



second: advisor.php

    $sID = $_GET['students'];
    $db_name="coop";
        $tbl_name="students";
        mysql_connect("localhost", "root", "");
        mysql_select_db("$db_name");
        $sql=mysql_query("SELECT sID FROM ".$tbl_name." WHERE sID=.$sID.") or die(mysql_error());
        $mysqlf =mysql_fetch_array($sql);
            $sID=$mysqlf['sID'];
            echo "$sID<br>";;
?>



我该如何解决这个问题?

谢谢所有



how can I solve this problem?

thanks for all

推荐答案

db_name = " ;
db_name="coop";


tbl_name = " ; mysql_connect(" " root" "); mysql_select_db("
tbl_name="students"; mysql_connect("localhost", "root", ""); mysql_select_db("


db_name" ); session_start();
db_name"); session_start();


这篇关于您的SQL语法有误;检查与您的MySQL对应的手册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆