Skip to main content

Posts

Bài 5 - SPEAKING - Tôi đây

Tự Học NGHE NÓI Tiếng Anh Cấp Tốc · Bài 5 - SPEAKING - Tôi đây

chitiet.php

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php if(isset($_GET['idbh'])) { $idbh=$_GET['idbh']; include("connect.php"); $sl="select TenBH, LoiBH from webnhac_baihat where idBH=$idbh"; $kq=mysqli_query($link,$sl); $d=mysqli_fetch_array($kq); ?> <h1 align="center"><?php echo $d['TenBH'];?></h1> <div><?php echo $d['LoiBH'];?></div> <?php }?> </body> </html>

casi.php - PHP#8MySQL#4 - Lấy các bài hát theo idCS

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Ca si</title> </head> <body> <?php include("connect.php"); $sl="select * from webnhac_casi"; $kq=mysqli_query($link,$sl); ?> <ul> <?php while($d=mysqli_fetch_array($kq)) { //Lấy các bài hát theo idCS: $slbh="select idBH, TenBH from webnhac_baihat where idCS=".$d['idCS']; $kqbh=mysqli_query($link,$slbh); if(mysqli_num_rows($kqbh)>0){ ?> <li><?php echo $d['HoTenCS'];?> <ul> <?php while($dbh=mysqli_fetch_array($kqbh)){ ?> <li><a href="chitietbh.php?idbh=<?php echo $dbh['idBH'];?>"><?php echo $dbh['TenBH'];?></a></li> <?php }?> </ul> </li> <?php } }?> </ul> </body> </html> //connect.php   <?php //Kết nối đến server DB: ...

connect.php

  <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //Chọn database cần thao tác: mysqli_select_db($link,"webtintuc") or die("Không tồn tại DB này!"); mysqli_query($link,"set names 'utf8'"); ?>

index.php - Kết nối đến server DB

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //Chọn database cần thao tác: mysqli_select_db($link,"webtintuc") or die("Không tồn tại DB này!"); //$link=mysqli_connect("localhost","root","","webtintuc") or die("Không thể kết nối đến Server!"); //Lấy dữ liệu từ bảng user: idUser, Hoten, Username, Email: $sl="select idUser, HoTen, Username, Email from user"; //Thực hiện query: $kq=mysqli_query($link,$sl); $tong=mysqli_num_rows($kq); echo "Số dòng dữ liệu lấy được:$tong<br/>"; /*for($i=1;$i<=$tong;$i++) { //Lấy 1 dòng dữ liệu từ $kq: $d=mysqli_fetch_array($kq); echo $d['HoTen']." có usern...

lienket.php - chèn thuộc tính Url vào Ten từ database & in lên Bảng

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php include("connect.php"); $sl="select Ten, Url from lienket order by ThuTu ASC"; $kq=mysqli_query($link,$sl); ?> <table width="100" border="1" cellspacing="0" cellpadding="0"> <tbody> <tr> <th scope="col">Các liên kết</th> </tr> <?php while($d=mysqli_fetch_array($kq)) { ?> <tr> <td><a href="<?php echo $d['Url'];?>"><?php echo $d['Ten'];?></a></td> </tr> <?php }?> </tbody> </table> </body> </html> //connect.php   <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đ...

select.php - PHP#8MySQL#4 - onChange="location.href=this.value"

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Select - php</title> </head> <body> <?php include("connect.php"); $sl="select Ten, Url from lienket order by ThuTu ASC"; $kq=mysqli_query($link,$sl); ?> <form id="form1" name="form1" method="post"> <select name="lienket" id="lienket" onChange="location.href=this.value"> <option>---Chọn liên kết---</option> <?php while($d=mysqli_fetch_array($kq)) { ?> <option value="<?php echo $d['Url'];?>"><?php echo $d['Ten'];?></option> <?php }?> </select> </form> </body> </html> //connect.php   <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //C...