-1

I'm trying to get the data from my database according to the certain id if the database.

Here is my code. But they are not working else $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;
?>
pgSystemTester
  • 8,979
  • 2
  • 23
  • 49

3 Answers3

1

your forgot to fetch the value try this

<?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'];
}

}


?>
JYoThI
  • 11,977
  • 1
  • 11
  • 26
0

You need to use 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;
  }
}
?>
RJParikh
  • 4,096
  • 1
  • 19
  • 36
0

Try this I hope it will work,

<?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;
  }
}
?>
user2110253
  • 317
  • 4
  • 12