<?php mysql_connect("localhost","username","password") or die($error);
mysql_select_db("db") or die($error);
$query = "SELECT * FROM music WHERE user='$profilename' ORDER BY id DESC";
$construct = "SELECT * FROM music WHERE user='$profilename' ORDER BY id DESC";
$run = mysql_query($construct);
$foundnum = mysql_num_rows($run);
while ($runrows = mysql_fetch_assoc($run))
{
$title = $runrows['songname'];
$song = $runrows['title'];
$name = $_FILES["file"]["name"];
$user = $runrows['user'];
$thumbnail = $runrows['thumbnail'];
$identify2 = $runrows['id'];
$echovar8 = substr($song,0,35).'...';
$echovar = "<a href=/listen.php?u=$identify2><img src='thumbnails/$thumbnail' width='120' height='80'></a>";
#$description = $runrows['description'];
#$url = $runrows['url'];
if (strlen($song)>34)
{
echo "<script>
function LinkOnClick(box) {
$('#profile').load('getprofilevideo.php?u=$identify2');
}
</script><div onmouseover='boxOnHover(this);' onmouseout='boxOffHover(this);' onclick='LinkOnClick($identify2);' onclick='boxOnHover(this);'><table><tr><td>$echovar</td><td> <a href=/listen.php?u=$identify2>$echovar8</a></b></td></tr></table></div><hr><p>";
}
else
echo "<script>
function LinkOnClick(box) {
$('#profile').load('getprofilevideo.php?u=$identify2');
}
</script><div onmouseover='boxOnHover(this);' onmouseout='boxOffHover(this);' onclick='LinkOnClick($identify2);' onclick='boxOnHover(this);'><table><tr><td>$echovar</td><td> <a href=/listen.php?u=$identify2>$song</a></b></td></tr></table></div><hr><p>";
}
?>
^^這是我profile.php頁我執行查詢,然後使用一個變量作爲一個鏈接,但鏈接無法正常工作
<?php
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$dbname = "db";
//Connect to MySQL Server
mysql_connect($dbhost, $dbuser, $dbpass);
//Select Database
mysql_select_db($dbname) or die(mysql_error());
// Retrieve data from Query String
$id2 = $_GET['u'];
// Escape User Input to help prevent SQL Injection
$id2 = mysql_real_escape_string($id2);
$run = mysql_query("SELECT * FROM music WHERE id='$id2'");
$getdata10 = mysql_query("SELECT * FROM music WHERE id='$id2'");
while ($runrows = mysql_fetch_assoc($run))
{
$title = $runrows['songname'];
$song = $runrows['title'];
$identify = $runrows['id'];
$name = $_FILES["file"]["name"];
$user = $runrows['user'];
$thumbnail = $runrows['thumbnail'];
$color = $profileresult['color'];
$bubblecolor = $profileresult['bubblecolor'];
}
echo '
<link rel="stylesheet" type="text/css" href="/demos/standalone.css"/>
<script type="text/javascript" src="mp3/flowplayer-3.2.6.min.js"></script>
<!-- this A tag is where your Flowplayer will be placed. it can be anywhere -->
<a
href="mp3/song.mp3"
style="display:block;width:640px;height:385px"
id="player">
</a>
<!-- this will install flowplayer inside previous A- tag. -->
<script>
$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", {
clip: {
url: "mp3/'.$title.'",
// this style of configuring the cover image was added in audio
// plugin version 3.2.3
coverImage: { url: "thumbnails/'.$thumbnail.'"}
}
});
</script>
<br><b> '.$song.'</b><br><h10> <a href=/listen.php?u='.$identify.'>(Comments and more)</a></h10><p>';
?>
^^這是getprofilevideo.php
我的問題是,當我點擊div並嘗試執行onclick ='LinkOnClick($ identify2);'我的頁面不斷向我顯示查詢的最後一項。不過,我需要profile.php來顯示我點擊的實際視頻,而不是查詢的最後一個視頻。爲更好地解釋,請轉至http://www.pearlsquirrel.elementfx.com/profile.php?u=wildcard,並將鼠標懸停在歌曲上時,單擊突出顯示的div,然後可以看到問題。它不斷加載「預覽3」,而不是你點擊的歌曲。我花了數週時間來解決這個問題。任何幫助將不勝感激,感謝您的反饋!
非常感謝!你不知道我多麼感激這一點,我一直在努力尋找一個數周的解決方案。非常感謝幫助。謝謝! – Eggo
@Eggo沒問題。另外,如果它回答了你的問題,你可能想接受這個答案。您可以通過點擊左側旁邊的複選標記來完成此操作。 – dqhendricks