Web浏览器正在确定我生成的php生成的音频播放器有无效的来源。我也正在注意一下' 0'就在我的分页链接之前。
老实说,我不明白。我还在几个网络浏览器中检查了这些元素,它们看起来都在向我展示有效的HTML代码。
<?php
include_once("connect.php");
$count_query = mysqli_query($dbhandle,"SELECT NULL FROM my_audio");
$count = mysqlI_num_rows($count_query);
$previous_page = "' 'Previous";
$next_page = "Next ";
//global $output;
//pagination starts here
if(isset($_GET['page']))
{
$page = preg_replace("#[^0-9]#","",$_GET['page']);
}
else
{
$page = 1;
}
$perPage = 5;
$lastPage = ceil($count/$perPage);
if($page <1)
{
$page =1;
}
else if($page>$lastPage)
{
$page = $lastPage;
}
$limit = "LIMIT ".($page - 1)*$perPage.",$perPage";
//$limit = " LIMIT 0,1";
$query = mysqli_query($dbhandle,"SELECT * FROM my_audio $limit");
if($lastPage != 1)
{
$output = '';
$pagination=0;
if($page != $lastPage)
{
$next = $page + 1;
$pagination.='<a href="sqltest1.php?page='.$next.'">'.$next_page.'</a>';
}
if($page != 1)
{
$prev = $page - 1;
$pagination.='<a href="sqltest1.php?page='.$prev.'">'.$previous_page.'</a>';
}
}
while($row = mysqli_fetch_array($query))
{
$sourcefile=$row['location'];
**$output.='<audio controls="controls"><source src="'.$sourcefile.'" type="audio/mpeg"> Your browser does not support the audio tag.</audio><br><br>';
}**
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Blueprint: Slide and Push Menus" />
<title> Some Practice Stuff</title>
</head>
<body>
<h1>Php Pagination Trial</h1>
<?php echo $output;?>
<?php echo $pagination;?>
</body>
</html>
答案 0 :(得分:0)
您正在将$pagination
初始化为数值变量,其值为零而不是空字符串。这意味着当您将其与字符串连接时,它将以0
为前缀。
变化:
$pagination=0;
为:
$pagination="";