添加AJAX頭:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
的按鈕使用示例:
<a href="#" onClick="$('#content_s').load('/sql.php?value=some_path');">News</a>
你可以如果需要,請將$ content_s懸停在CSS文件中。
而在你的HTML來顯示數據:
<div id="content_s">
</div>
你sql.php文件將是這樣的:
<?php
$this_path_short = $_GET['value']; // stay frosty, it's SQLi vurnable, but this will get "some_path" I belive. I didn't test this though, but it should work
$query1="SELECT * FROM tracks WHERE uploaded_page='$this_path_short' ORDER BY id DESC";
...
您可以用PHP生成
編輯編輯編輯編輯鏈接編輯編輯編輯編輯
索引。 PHP 你說的路徑到播放列表中的index.php這樣:
<html>
<head>
<title>Playlist</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<?php $path = 'http://www.youtube.com/watch?v=Jx0oOZmY5KM'; ?>
<div id="menu">
<a href="#" onClick="$('#content_s').load('playlist.php/?val=<?php echo $path ?>');">Load Playlist</a>
</div>
<div id="content_s">
</div>
</html>
playlist.php:
<?php
$this_path_short = $_GET['val'];
echo '$this_path_short = ' .$this_path_short.'<br>';
echo 'This is how the query looks like right now: "SELECT * FROM tracks WHERE uploaded_page=\''.$this_path_short.'\' ORDER BY id DESC";';
?>
這個例子將給你它是如何工作
的想法1。
2.
我真的希望你[正確轉義您的SQL查詢(http://bobby-tables.com/php)。 – tadman 2012-08-10 23:07:34