加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

使用php和mysql在iFrame V2中显示特定的URL

发布时间:2020-12-13 15:56:08 所属栏目:PHP教程 来源:网络整理
导读:我是SQL和 PHP的新手,需要以下问题的帮助. 我有一个SQL数据库,例如,“用户名,密码,国籍,类”,我想要做的是,一个简单的PHP或SQL查询,它将从数据库检查用户的类字段并在指定的地方显示相应的URL iFrame(例如,类是J1,J2,J3,如果字段已经包含J3,那么在加载时显示
我是SQL和 PHP的新手,需要以下问题的帮助.

我有一个SQL数据库,例如,“用户名,密码,国籍,类”,我想要做的是,一个简单的PHP或SQL查询,它将从数据库检查用户的类字段并在指定的地方显示相应的URL iFrame(例如,类是J1,J2,J3,如果字段已经包含J3,那么在加载时显示相应的URL,没有任何用户输入.(所有都将提前决定)

您可以将其视为学生档案,一旦学生成功登录,查询将读取班级字段,并根据找到的内容,它将返回具有正确链接的可点击URL.

对于我现在的水平来说,这太难了,希望有人可以对我有所了解.

这是用户成功登录后的代码.

<!-- NOTIFICATIONS STARTS HERE -->
<?php
require_once('connection.php');
$id=$_SESSION['SESS_MEMBER_ID'];
$result3 = mysql_query("SELECT * FROM member where mem_id='$id'");
while($row3 = mysql_fetch_array($result3))
{ 
$fname=$row3['fname'];
$country=$row3['country'];
$class=$row3['class'];
$headteacher=$row3['headteacher'];
$attendance=$row3['attendance'];
$homework=$row3['homework'];
$messageparents=$row3['messagestudent'];
}
?>
<table width="468" border="0" align="center" cellpadding="0">
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS">
<table width="468" border="0" align="center" cellpadding="0">
<tr>
<td class="FONTS"><div align="left" class="FONTS"><b>名前:</b></div>
<?php echo $fname ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>国:</b></div>
<?php echo $country ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>クラス:</b></div>
<?php echo $class ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>家庭教師の先生:</b></div>
<?php echo $headteacher ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>出席率:</b></div>
<?php echo $attendance ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>宿題率:</b></div>
<?php echo $homework ?></td>
</tr>
<tr class="FONTS">
<td valign="top"><div align="left" class="FONTS"><b>先生からメッセージ:</b>            
</div>
<?php echo $messagestudent ?></td>
</tr>
</table>
</div></td>
</tr>
</table>
<p align="center" class="FONTS"><a href="index.php">ログアウト</a></p>
<!-- NOTIFICATIONS ENDS HERE -->

它已经按预期工作,所以我不会改变它,除非它是完全必要的,我只需要能够显示该URL链接.

提前致谢!

解决方法

<?php
if($class=='J1')
echo "<a href='www.first_url.com'>Click Here</a>";
else if($class=='J2')
echo "<a href='www.second_url.com'>Click Here</a>"; 
..............
?>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读