我正在尝试根据数据库中的特定ID从我的数据库中获取数据。
这是我的代码。但他们没有其他工作
$selectquery,$resultsgetdata,$countprodu
<?php
$profrom = $_GET['id'];
$selectquery = "SELECT * FROM tbl_name WHERE proid = '$profrom'";
$resultsgetdata = mysql_query($selectquery);
$countprodu= mysql_num_rows($resultsgetdata);
if($countprodu>0)
{
$proidid = $row['proid'];
$proidName = $row['proName'];
$proidDescription = $row['proDescription'];
$Category = $row['proCategory'];
$Price = $row['Price'];
$Photo1name = $row['Photo1name'];
}
echo $proidid;
?>
答案 0 :(得分:1)
你忘了取价值试试这个
<?php
$profrom = $_GET['id'];
$selectquery = "SELECT * FROM tbl_name WHERE proid = '$profrom'";
$resultsgetdata = mysql_query($selectquery);
$countprodu= mysql_num_rows($resultsgetdata);
if($countprodu>0)
{
while($row = mysql_fetch_assoc($resultsgetdata){
$proidid = $row['proid'];
$proidName = $row['proName'];
$proidDescription = $row['proDescription'];
$Category = $row['proCategory'];
$Price = $row['Price'];
$Photo1name = $row['Photo1name'];
}
}
?>
&#13;
答案 1 :(得分:0)
您需要使用mysql_fetch_assoc()
。
<?php
$profrom = $_GET['id'];
$selectquery = "SELECT * FROM tbl_name WHERE proid = '$profrom'";
$resultsgetdata = mysql_query($selectquery);
$countprodu= mysql_num_rows($resultsgetdata);
if($countprodu>0)
{
while($row = mysql_fetch_assoc($resultsgetdata))
{
$proidid = $row['proid'];
$proidName = $row['proName'];
$proidDescription = $row['proDescription'];
$Category = $row['proCategory'];
$Price = $row['Price'];
$Photo1name = $row['Photo1name'];
echo $proidid;
}
}
?>
答案 2 :(得分:0)
试试这个我希望它会起作用,
<?php
$profrom = $_GET['id'];
$selectquery = "SELECT * FROM tbl_name WHERE proid = '$profrom'";
$resultsgetdata = mysql_query($selectquery);
$countprodu= mysql_num_rows($resultsgetdata);
if($countprodu>0)
{
while($row = mysql_fetch_array($resultsgetdata))
{
$proidid = $row['proid'];
$proidName = $row['proName'];
$proidDescription = $row['proDescription'];
$Category = $row['proCategory'];
$Price = $row['Price'];
$Photo1name = $row['Photo1name'];
echo $proidid;
}
}
?>