Skip to main content

Posts

b2.php - PHP#9MySQL#5 - Submit bằng lệnh JavaScrip: onChange="form1.submit();" thay thế nút Submit - Dùng Selected khi chọn đối tượng

//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'"); ?> //b2.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>b2_duc.php</title> </head> <body> <form method="get" id="form1" name="form1"> <p> <label for="chungloai">Chủng loại sp:</label> <select name="chungloai" id="chungloai" onChange="form1.submit(); "> <?php include("connect.php"); $sl="select * from webtm_chungloaisp"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <option value="...

b1.php - PHP#9MySQL#5 - Lọc sản phẩm

//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'"); ?> //b1.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>b1_duc.php</title> </head> <body> <form method="get" id="form1" name="form1"> <p> <label for="chungloai">Chủng loại sp:</label> <select name="chungloai" id="chungloai"> <?php include("connect.php"); $sl="select * from webtm_chungloaisp"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <option value="<?php echo $d['idCL'];?>...

theloaibh.php, dsbh.php - PHP#9MySQL#5 - bắt đối tượng khi click, liên kết qua trang khác để hiện thị nội dung tương ứng $_GET[' '] trong PHP

 //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'"); ?> //theloaibh.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>theloaibh.php</title> </head> <body> <?php include("connect.php"); $sl="select * from webnhac_theloai"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <p><a href="dsbh.php?idTL=<?php echo $d['idTL'];?>"><?php echo $d['TenTL'];?></a></p> <?php } ?> </body> </html>

PHP#9MySQL#5 - locSP( b1.php, b2.php, b3.php) - Lọc sản phẩm

//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'"); ?> //b1 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="get"> <p> <label for="chungloai">Chủng loai sp:</label> <select name="chungloai" id="chungloai"> <?php include("connect.php"); $sl="select * from webtm_chungloaisp"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)){ ?> <option value="<?php echo $d['idCL'];?...

in HoTenCS từ database ra màn hình - Tiếp theo in thêm TenBH dưới HoTenCS - Tiếp theo chỉ hiện những ca sĩ có bài hát. CUỐI CÙNG in ra lời bài hát từ liên kết đến trang chitietbh.php

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Ca si Duc 4</title> </head> <body> <?php include("connect_duc.php"); $sl="select * from webnhac_casi"; $kq=mysqli_query($link,$sl); ?> <ul> <?php while($d=mysqli_fetch_array($kq)) { $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="chitiet_duc.php?idbh=<?php echo $dbh['idBH']; ?>"><?php echo $dbh['TenBH']; ?></a></li> <?php } ?> </ul> </li> <?php } } ?> </ul> </body> </html> //connect_duc.php <?php $link...

in HoTenCS từ database ra màn hình - Tiếp theo in thêm TenBH dưới HoTenCS - Tiếp theo chỉ hiện những ca sĩ có bài hát

  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Ca sĩ Duc</title> </head> <body> <?php $link=@mysqli_connect("localhost","root","") or die("Không tìm thấy Sever"); mysqli_select_db($link,"webtintuc") or die("Không tìm thấy DB"); mysqli_query($link, "set names 'utf8'"); $sl="select * from webnhac_casi"; $kq=mysqli_query($link,$sl); ?> <ul> <?php while($d=mysqli_fetch_array($kq)) { $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><?php echo $dbh['TenBH']; ?></li> ...

in HoTenCS từ database ra màn hình - Tiếp theo in thêm TenBH dưới HoTenCS

<!doctype html> <html> <head> <meta charset="utf-8"> <title>Ca sĩ Duc</title> </head> <body> <?php $link=@mysqli_connect("localhost","root","") or die("Không tìm thấy Sever"); mysqli_select_db($link,"webtintuc") or die("Không tìm thấy DB"); mysqli_query($link, "set names 'utf8'"); $sl="select * from webnhac_casi"; $kq=mysqli_query($link,$sl); ?> <ul> <?php while($d=mysqli_fetch_array($kq)) { ?> <li><?php echo $d['HoTenCS']; $slbh="select idBH, TenBH from webnhac_baihat where idCS=".$d['idCS']; $kqbh=mysqli_query($link,$slbh); ?> <ul> <?php while($dbh=mysqli_fetch_array($kqbh)){ ?> <li><?php echo $dbh['TenBH']; ?></li> <?php } ?> ...