|
|
|
รบกวนช่วยดูโค้ดหน่อคะ รูปตัวอย่างไม่ขึ้น รายละเอียดไม่ขึ้น กดยกเลิกแต่ก้อยังแชร์ นั่งแก้มาสองวันแล้วคะยังแก้ไม่ได้เลย |
|
|
|
|
|
|
|
Code
<?php
mysql_connect("localhost", "root", "root") or die("mysql error");
mysql_select_db("videoreview") or die("mysql error");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$vid=$_GET["id_comment"];
$name=$_POST["comment_name"];
$detail=$_POST["comment_detail"];
if($_POST["comment"]!=null)
{
$sql_insert=("INSERT INTO comment(`vid`,`comment_name`,`comment_detail`,comment_date)Values('$vid','$name','$detail','".date("Y-m-d H:i:s")."')");
mysql_query($sql_insert) or die($sql_insert);
//echo$sql_insert;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="title" content="เว็บไทยครีเอท" >
<meta name="description" content="สอนเกี่ยวกับ php asp asp.net c#..." >
<link rel="image_src" href="http://fbrell.com/f8.jpg" >
<title>Share & Comment Video</title>
<script src="js/jquery-1.9.1.min.js"></script>
</head>
<body bgcolor="#CCCCCC"font-size="16px">
<div id='fb-root'></div>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<p><a onclick='postToFeed(); return false;'></a></p>
<p id='msg'></p>
<script>
FB.init({appId: "xxxxxxxx", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method:'feed',
redirect_uri:'http://localhost/videoreview/comment.php?id_comment=$id',
link:'https://developers.facebook.com/docs/reference/dialogs/',
picture:'http://fbrell.com/f8.jpg',
name:'Share&Comment Video',
caption:'Share&Comment Video',
description:'zizzee.com'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<Form method="post" action="">
<center><div style="background-color:#F5F9FD;height:auto;width:80%;text-align:left; ">
<center><div div style="background-color:#FAFAD2;height:auto;width:95%;text-align:Left; ">
<br>
<br>
<h2 style="margin-bottom:0;"><font color="#00BFFF">Comment</font></h2>
<?php
mysql_connect("localhost", "root", "root") or die("mysql error");
mysql_select_db("videoreview") or die("mysql error");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$id=$_GET["id_comment"];
$sql_result = mysql_query("SELECT * FROM videoreview WHERE vid='$id'");
$path_img = "img/";
$path_vdo = "video/";
while ($result = mysql_fetch_array($sql_result))
{
if($result["review_img_path"]!="")
{
echo"<img style='width:70px; height:100px;' src='".$path_img . $result["review_img_path"]."'>";
}
elseif($result["review_img_path"]== null)
{
echo"<img style='width:70px; height:100px;' src='img/imgzizzee.jpg'>";
}
echo"ชื่อ " . $result["review_name"] . "";
echo"<br>";
echo"Title " . $result["comment"] . "";
echo"<br>";
if ($result["video_type"] == "y")
{
echo"<embed src='http://www.youtube.com/embed/".$result["video_url"]."?fs=1&hl=en_US&rel=0'type='application/x-shockwave-flash'
width='560' height='315' allowscriptaccess='always' allowfullscreen='true'
pluginspage='http://www.adobe.com/go/getflashplayer'></embed>";
}
elseif ($result["video_type"] == "u")
// echo "u";
{
$vdo= $path_vdo.$result["video_path"];
echo"<video width='560' heigth='315' controls>
<source src='$vdo' type='video/mp4'/>
<object data='$vdo' width='560' heigth='315'>
<embed width='560' heigth='315' src='$vdo'>
</object> </video>";
}
echo" ";
echo" ";
echo" ";
echo"<a name='fb_share' share_url='http://localhost/videoreview/comment.php?id_comment=$id' type='button' href='http://www.facebook.com/sharer.php'>Share</a>";
echo" ";
echo" ";
echo" ";
echo"<a href='https://twitter.com/share' class='twitter-share-button' data-url='http://localhost/videoreview/comment.php?id_comment=$id' data-via='Zizzeedotcom' data-lang='en' data-count='none'>Tweet</a>";
echo"<br>";
}
?>
<br>
ชื่อ <input type="text" name="comment_name">
<br>
Comment <br><textarea name="comment_detail" cols="50" rows="10"></textarea>
<br>
<input type="submit" value="comment" name="comment">
<br>
<br>
<?php
mysql_connect("localhost", "root", "root") or die("mysql error");
mysql_select_db("videoreview") or die("mysql error");
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
$id_c=$_GET['id_comment'];
$sql_comment=("SELECT comment.* FROM comment
WHERE comment.vid='$id_c'");
$result_show = mysql_query($sql_comment);
while ($result= mysql_fetch_array($result_show))
{
echo"<br>";
echo"ชื่อ";
echo " ";
echo " ";
echo"".$result["comment_name"]."";
echo"<br>";
echo"".$result["comment_detail"]."";
echo"<br>";
echo"".$result["comment_date"]."";
echo"<hr>";
}
?>
</div></center>
</div></center>
</form>
</body>
</html>
Tag : PHP, MySQL, JavaScript
|
ประวัติการแก้ไข 2013-05-15 13:20:31
|
|
|
|
|
Date :
2013-05-15 13:16:52 |
By :
Ryo |
View :
998 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$id_c=$_GET['id_comment']มีค่าคะ
ปัญหาที่ติดคือการเขียนสคริปตอนที่แชร์ไปเฟสบุ๊คคะCode
<div id='fb-root'></div>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
<p><a onclick='postToFeed(); return false;'></a></p>
<p id='msg'></p>
<script>
FB.init({appId: "xxxxxxxx", status: true, cookie: true});
function postToFeed() {
// calling the API ...
var obj = {
method:'feed',
redirect_uri:'http://localhost/videoreview/comment.php?id_comment=$id',
link:'https://developers.facebook.com/docs/reference/dialogs/',
picture:'http://fbrell.com/f8.jpg',
name:'Share&Comment Video',
caption:'Share&Comment Video',
description:'zizzee.com'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<Form method="post" action="">
|
ประวัติการแก้ไข 2013-05-16 09:24:25
|
|
|
|
Date :
2013-05-16 09:21:50 |
By :
Ryo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตรงตัวอักษรสีแดงอ่ะค่ามันไม่โชว์ตอนจะแชร์อ่ะคะไม่ทราบว่าที่เขียนไปถูกหรือป่าว
|
ประวัติการแก้ไข 2013-05-16 09:26:52
|
|
|
|
Date :
2013-05-16 09:25:31 |
By :
Ryo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|