php查询数据库表问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>学生课题查询</title><style type="text/css"><!--.STYLE1 {font-size: 14px}--></style></head><body><?php//######################学生查询所选课题########################## include "config.php"; include "header.php";?> <?if($search){ if ($xuehao=="") { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请填写您的学号!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"1;url=query.php\">"; exit; } $query="select * from $student_table where xuehao='$xuehao'"; mysql_query("set names 'gb2312'"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row==0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有注册,或者你的输入有误,请重新输入!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=query.php\">"; exit; } $query="select id as sm from $student_table where xuehao='$xuehao'"; mysql_query("set names 'gb2312'"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[sm]==0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有选择课题,请去选题!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=keti_list.php\">"; exit; } ?><table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#333333" align="center"> <tr> <td width="78" height="30" bgcolor="#FFFFFF"> <div align="center" class="text"> <p class="STYLE1">学生学号</p> </div> </td> <td width=97 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">学生姓名</div> </td> <td width="329" height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1"> 课题名称 </div> </td> <td width=106 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">指导教师</div> </td> <td width=84 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">职称</div> </td> </tr> <? $n=0; $query=mysql_query("select * from $jiaoshi_table,$student_table where $jiaoshi_table.id=$student_table.id and $student_table.xuehao='$xuehao'"); mysql_query("set names 'gb2312'"); while($row=mysql_fetch_array($query)){ if(($n%2)!='0'){ echo "<tr bgcolor=#FFFFff>";} else{ echo "<tr bgcolor=#E4E4E4>"; } echo" <td height='22' class='STYLE1'> <div align='center'>".$row['xuehao']."</div></td> <td height='22'> <div align='center' class='STYLE1'>".$row['name']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['subject']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['teacher']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['zhicheng']."</div></td> </tr> "; $n++; } ?></table> <p> </p><?php include "foot.php";?>
当我输入学号查询的时候,运行结果却是一堆乱七八糟的东西。。。
注:我的表名叫做teacher,student
回复讨论(解决方案)
你截的图看看
你截的图看看
你截的图看看
哇塞,版主亲自回复。偶表示好激动地说。
你没开启段标签
改成
你没开启段标签
改成
你没开启段标签
改成
你代码到91行之前都在执行,你就不能开全了吗
$n=0; $query=mysql_query("select * from $jiaoshi
这里还有一个,你没改成
你代码到91行之前都在执行,你就不能开全了吗
$n=0; $query=mysql_query("select * from $jiaoshi
这里还有一个,你没改成
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>学生课题查询</title><style type="text/css"><!--.STYLE1 {font-size: 14px}--></style></head><body><?php//######################学生查询所选课题########################## include "config.php"; include "header.php";?><?phpif($search){ if ($xuehao=="") { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>请填写您的学号!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"1;url=query.php\">"; exit; } $query="select * from $student_table where xuehao='$xuehao'"; mysql_query("set names GB2312"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row==0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有注册,或者你的输入有误,请重新输入!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=query.php\">"; exit; } $query="select id as sm from $student_table where xuehao='$xuehao'"; mysql_query("set names 'GB2312'"); $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[sm]==0) { echo"<p align=\"center\"><font color=\"#FF0000\"><b><big>你还没有选择课题,请去选题!</big></b></font></p>"; echo "<meta http-equiv=\"refresh\" content=\"2;url=keti_list.php\">"; exit; } ?><table width="700" border="0" cellspacing="1" cellpadding="0" bgcolor="#333333" align="center"> <tr> <td width="78" height="30" bgcolor="#FFFFFF"> <div align="center" class="text"> <p class="STYLE1">学生学号</p> </div> </td> <td width=97 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">学生姓名</div> </td> <td width="329" height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1"> 课题名称 </div> </td> <td width=106 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">指导教师</div> </td> <td width=84 height="30" bgcolor="#FFFFFF"> <div align="center" class="STYLE1">职称</div> </td> </tr> <?php $n=0; $query=mysql_query("select * from $jiaoshi_table,$student_table where $jiaoshi_table.id=$student_table.id and $student_table.xuehao='$xuehao'"); mysql_query("set names GB2312"); while($row=mysql_fetch_array($query)){ if(($n%2)!='0'){ echo "<tr bgcolor=#FFFFff>";} else{ echo "<tr bgcolor=#E4E4E4>"; } echo" <td height='22' class='STYLE1'> <div align='center'>".$row['xuehao']."</div></td> <td height='22'> <div align='center' class='STYLE1'>".$row['name']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['subject']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['teacher']."</div></td> <td height='22' class='STYLE1'> <div align='center'>".$row['zhicheng']."</div></td> </tr> "; $n++; } ?></table> <p> </p><?php include "foot.php";?>
if($search)
{
这个if没有关闭,即少了 } 号
if($search)
{
这个if没有关闭,即少了 } 号 好,我看看
if($search)
{
这个if没有关闭,即少了 } 号 是加在48行后吗?我加了以后就变成这样了
是加在48行后吗?
我不知道你的逻辑,你自己应该很清楚啊。
$search 和 $xuehao 你在哪定义的?
是加在48行后吗?
我不知道你的逻辑,你自己应该很清楚啊。
$search 和 $xuehao 你在哪定义的? 不太清楚啊,因为这个代码老师给的让做修改……
最后缺了个分号
}
include "foot.php";?>
最后缺了个分号
}
include "foot.php";?> 有分号啊
…… 楼主这错误看着太头晕,建议你用eclipse什么的去检查一下,丢的东西有点多啊
…… 楼主这错误看着太头晕,建议你用eclipse什么的去检查一下,丢的东西有点多啊 说我的最后一行是语法错误,unexpected 'EOF'这是什么意思?
最后缺了个分号
}
include "foot.php";?> 有分号啊
你上面贴的代码里没有
…… 楼主这错误看着太头晕,建议你用eclipse什么的去检查一下,丢的东西有点多啊 说我的最后一行是语法错误,unexpected 'EOF'这是什么意思?
你那少了一个括号的括回,仔细检查一下代码吧。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

长URL(通常用关键字和跟踪参数都混乱)可以阻止访问者。 URL缩短脚本提供了解决方案,创建了简洁的链接,非常适合社交媒体和其他平台。 这些脚本对于单个网站很有价值

在Facebook在2012年通过Facebook备受瞩目的收购之后,Instagram采用了两套API供第三方使用。这些是Instagram Graph API和Instagram Basic Display API。作为开发人员建立一个需要信息的应用程序

Laravel使用其直观的闪存方法简化了处理临时会话数据。这非常适合在您的应用程序中显示简短的消息,警报或通知。 默认情况下,数据仅针对后续请求: $请求 -

这是有关用Laravel后端构建React应用程序的系列的第二个也是最后一部分。在该系列的第一部分中,我们使用Laravel为基本的产品上市应用程序创建了一个RESTFUL API。在本教程中,我们将成为开发人员

Laravel 提供简洁的 HTTP 响应模拟语法,简化了 HTTP 交互测试。这种方法显着减少了代码冗余,同时使您的测试模拟更直观。 基本实现提供了多种响应类型快捷方式: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

PHP客户端URL(curl)扩展是开发人员的强大工具,可以与远程服务器和REST API无缝交互。通过利用Libcurl(备受尊敬的多协议文件传输库),PHP curl促进了有效的执行

您是否想为客户最紧迫的问题提供实时的即时解决方案? 实时聊天使您可以与客户进行实时对话,并立即解决他们的问题。它允许您为您的自定义提供更快的服务

2025年的PHP景观调查调查了当前的PHP发展趋势。 它探讨了框架用法,部署方法和挑战,旨在为开发人员和企业提供见解。 该调查预计现代PHP Versio的增长
