there are tables artist, track, & etc in the artist table there is : id name cover desc
and in the track table there is : id name desc artistid
so if i goto track.php?id=1 and then they print id name desc artistid i want to make this show the record from artist table with id recognition
and can you show me how to make multiple filter from recordset. because i have field "pubid" when the value is 1 this mean publish and then if the value is 2 this mean unpublish
sorry bad english thx u so much
Have a look at SQL Join . In order to only get records which may be published, you'll have to add another WHERE
clause. Like:
SELECT name, desc FROM track WHERE id = $id AND pubid = 1;
track.php?id=1 or track.php?id=1&pubid=1 track.php?id=1&pubid=2
<?php
if (isset($_GET['id'])) {
$artistid = $_GET['id'];
if (isset($_GET['pubid'])) {
$pudid = $_GET['pubid'];
$sql = "select `id`, `name` from `track` where `artistid` = {$artistid} and `pubid` = {$pupid} order by `desc`";
} else
$sql = "select `id`, `name` from `track` where `artistid` = {$artistid} order by `desc`";
$query = mysql_query($sql);
while (($row = mysql_fetch_array($query)) !== false) {
echo $row['name'];
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.