0

我正在尝试在页面上显示 YouTube 视频。代码存储在 mySQL 数据库中。

在这方面,我是一个真正的傻瓜。如果有人要求我就更改代码做出明智的决定,我将不知道该怎么做。我基本上是复制和粘贴类型,所以如果有人能给我一个更正的代码,我将非常感激。我敢肯定这个缺陷像公牛一样大,但是嘿,我在这方面有点短视!

我正在使用这段代码。我没有收到错误消息或任何与此相关的信息。只是一个空白页。

谢谢!!

尤金妮

这是我正在使用的代码:

<?php

$DBhost = "localhost";
$DBuser = "----";
$DBpass = "----";
$DBName = "----";
$table = "----";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");

@mysql_select_db("$DBName") or die("Unable to select database $DBName");

$results = mysql_query($sqlquery);


$clip1 = $row["clip1"];
$clip2 = $row["clip2"];
$clip3 = $row["clip3"];
$clip4 = $row["clip4"];


echo "<iframe src=\"{$clip1}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe>"; 
echo "<iframe src=\"{$clip2}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe>"; 
echo "<iframe src=\"{$clip3}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe>"; 
echo "<iframe src=\"{$clip4}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe>"; 

?> 
4

2 回答 2

0

定义处理结果集的正确方法

第一步:定义sql查询


   $sqlquery="select * from some_table";

第 2 步:运行查询


   $results = mysql_query($sqlquery);

第 3 步:检索结果


   while($row=mysql_fetch_array($results,MYSQL_ASSOC)){
      echo ""; 
   }

于 2013-08-13T13:43:01.137 回答
0

这有效:

$con=mysqli_connect("localhost","-----","------","--------");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$result = mysqli_query($con,"SELECT * FROM pool");


while($row = mysqli_fetch_array($result))
{
$clip1 = $row["clip1"];
$clip2 = $row["clip2"];
$clip3 = $row["clip3"];
$clip4 = $row["clip4"];
  }

echo "<iframe src=\"{$clip1}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe><p>"; 
echo "<iframe src=\"{$clip2}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe><p>"; 
echo "<iframe src=\"{$clip3}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe><p>"; 
echo "<iframe src=\"{$clip4}\" style=\"background: #fff;\" frameborder=\"0\" height=\"300\"     scrolling=\"auto\" width=\"480\"></iframe><p>";
于 2013-08-13T16:37:31.443 回答