0

我得到了结果。但我为每个人创建了 2 个不同的配置文件。但我得到了这两个人的相同个人资料详细信息。例如:sam 和 john 有不同的个人资料详细信息。但是当我打开 sam 的个人资料详细信息时,它会显示 john 的个人资料详细信息。实际上,它在每个不同的配置文件中都显示了一个细节。帮我。

“这是我的问题”

if(isset($_GET["employeecode"])){
$employeecode=$_GET["employeecode"];

require_once("dbconfig.php");

        $query = ("select t1.employeecode,t1.panno,t1.employeename,t1.esino,t1.designation,t1.paiddays,t1.department,t1.lopdays,t1.bank,t1.bankname,t1.pfno,t1.location,
                t2.v, t2.w,t2.x,t2.a,t2.b,t2.c,t2.d,t2.e,t2.f,t2.g,t2.h,t2.i,t2.j,t2.k,t2.l,t2.m,t2.n,t2.o,t2.p,t2.q,t2.r,t2.s,t2.t,t2.u,
                t3.total, t3.totals,t3.totalss,t3.netsalary,t3.amount,t3.mode
                FROM invoice t1,salaries t2,total1 t3
                WHERE t1.employeecode = t2.employeecode AND t2.employeecode = t3.employeecode");                

$result = mysql_query($query,$con) or die(mysql_error());
if(mysql_num_rows($result)>0){
    $row = mysql_fetch_array($result);
4

2 回答 2

0

使用此查询,使用忘记包含$employeecode在您的查询中。正因为如此,它显示了所有员工的结果。

$query = ("select t1.employeecode,t1.panno,t1.employeename,t1.esino,t1.designation,t1.paiddays,t1.department,t1.lopdays,t1.bank,t1.bankname,t1.pfno,t1.location,
 t2.v, t2.w,t2.x,t2.a,t2.b,t2.c,t2.d,t2.e,t2.f,t2.g,t2.h,t2.i,t2.j,t2.k,t2.l,t2.m,t2.n,t2.o,t2.p,t2.q,t2.r,t2.s,t2.t,t2.u,
 t3.total, t3.totals,t3.totalss,t3.netsalary,t3.amount,t3.mode
 FROM invoice t1,salaries t2,total1 t3
 WHERE t1.employeecode = t2.employeecode AND t2.employeecode = t3.employeecode AND t1.employeecode = '$employeecode'");
于 2013-02-20T12:00:01.917 回答
0

您似乎没有指定要搜索的特定员工,只有“t1.employeecode = t2.employeecode”。

试试这个:

if(isset($_GET["employeecode"])){
    $employeecode=$_GET["employeecode"];

require_once("dbconfig.php");

$query = ("select t1.employeecode,t1.panno,t1.employeename,t1.esino,t1.designation,t1.paiddays,t1.department,t1.lopdays,t1.bank,t1.bankname,t1.pfno,t1.location, t2.v, t2.w,t2.x,t2.a,t2.b,t2.c,t2.d,t2.e,t2.f,t2.g,t2.h,t2.i,t2.j,t2.k,t2.l,t2.m,t2.n,t2.o,t2.p,t2.q,t2.r,t2.s,t2.t,t2.u, t3.total, t3.totals,t3.totalss,t3.netsalary,t3.amount,t3.mode FROM invoice t1,salaries t2,total1 t3 WHERE t1.employeecode = " . $employeecode . " AND t2. employeecode = " . $employeecode . " AND t3..employeecode = " . $employeecode . "");             

$result = mysql_query($query,$con) or die(mysql_error());
if(mysql_num_rows($result)>0)
{
    $row = mysql_fetch_array($result);

正如您在 WHERE 查询末尾看到的那样,我将 $employeecode 值嵌入到字符串中,以便查询将搜索特定用户。

于 2013-02-20T12:01:53.357 回答