我不熟悉SQL和PHP,並且需要以下問題的幫助。使用php和mysql在iFrame V2中顯示特定的URL
我有一個SQL數據庫,例如,「用戶名,密碼,國籍,類」,我想要做的是一個簡單的PHP或SQL查詢,將從數據庫中檢查用戶的類字段並顯示相應的指定的iFrame中的URL(例如,類別爲J1,J2,J3,如果該字段已包含J3,則加載時會顯示相應的URL,而無需任何用戶輸入)(全部將事先決定)
您可以將其視爲學生檔案,一旦學生成功登錄,該查詢將讀取班級字段,並根據它找到的內容,返回具有正確鏈接的可點擊的網址。
This i對於我現在的水平來說,這太困難了,希望有人能夠對我有所瞭解。
這是用戶後的代碼登錄成功。
<!-- 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鏈接。
在此先感謝!
如果你剛開始,爲什麼你使用舊的方法? mysql函數現在已經被殺死了一段時間。學習新的東西時,比如PHP,學習更新的指南和教程。你應該使用mysqli或PDO。 –
這是你的完整代碼? – Saty
好吧,它不像現在開始,我很久以前就學習過,只是重新考慮它,但我認爲我的lvl作爲首發, 不,這個代碼只是結果代碼,還有其他3個文件涉及。 –