标题有点难以理解,所以基本上我正在制作一个Pastebin克隆,并试图做一种viewmember.php?id = 1213用于查看贴纸的东西。但是,我根本无法弄清楚。我已经做了很多研究,在最终理解了我必须做的事情之后(或者我认为),我做了这个,不知道为什么它不起作用。
<?php
require 'connection.php';
$getid = $_GET["id"];
$sql = "SELECT * FROM pasteinfo WHERE id = ?";
$stmt = $con->prepare($sql);
$stmt->bind_param("i", $getid);
echo $stmt;
&GT;
我可能只是愚蠢。谢谢你的帮助。
答案 0 :(得分:1)
您需要运行命令来执行查询。
$sql = "SELECT field1, field2 FROM pasteinfo WHERE id = ?"; // Specify fields in query
$stmt->bind_param("i", $getid); /* bind parameters for markers */
$stmt->execute(); /* execute query */
$stmt->bind_result($field1, $field2); /* bind result variables */
$stmt->fetch(); /* fetch value */
echo "Field 1:".$field1;
echo "Field 2:".$field2;
答案 1 :(得分:0)
$resultss = mysql_query("SELECT * FROM potentiometer_sensor order by S_No desc limit 0,10");
while($rowss = mysql_fetch_array($resultss))
{
$time1 = $rowss['2'];
$time2 = $rowss['2'];
echo "t1: ".$t1=strtotime($time1);
echo "<br/>t2: ".$t2=strtotime($time2);
echo "<br/>end:".$end=strtotime($time1);
echo "<br/>floor value:";
var_dump (floor(((($end- $t1)/60)/60))/60);
$Hours = floor(((($end- $t1)/60)/60)/60);
echo "<b>".$Hours.' </b>Hours ';
}