Hi!
I am new here. I am new in php too..
Can somebody help me in solve this error?
I can go to the page that but cannot call the data from the database.
This is my code:

<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("pqs", $con);
$ref1 = $_REQUEST['$ref1'];
$result = mysql_query("SELECT * FROM userdb WHERE User_tcno = '$ref1' LIMIT 1");
?>

<form name="form1" method="post" action="view_user.php">
  <p>&nbsp;</p>
	
  <?php while($row = mysql_fetch_array($result))
				{

				?>
	
  <table width="545" border="0" align="center" bordercolor="#F0F0F0">
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th width="196" scope="col"><div align="right" class="style9">User TC No. </div></th>
      <th width="5" scope="col"><div align="center"><strong>:</strong></div></th>
      <th width="330" scope="col"><div align="left"><?php echo $row['User_tcno']; ?></div></th>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">User Name </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_name']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Department</div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_dep']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Access Username </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_username']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Access Password </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_passsword']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th height="24" scope="row"><div align="right" class="style9">Access Level </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_level']; ?></div></td>
    </tr>

	  <?php }?>

    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th colspan="3" scope="row"><div align="right"></div></th>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th height="44" colspan="3" scope="row"><div align="center">
	  
        <input name="print" type="submit" id="print" value="Print" onclick="window.print();" /> 
		<input name="close" type="submit" id="close" value="Close" onclick="" />
		 </a>
      </div></th>
    </tr>
  </table>
  <?php 
mysql_close($con);
?>
  
  <p>&nbsp;</p>
  <div id="footer">
    <p align="left"><strong>Access Level description:</strong><br />
      Level 1   : Admin page<br />
      Level 2	: HRA page<br />
      Level 3	: Guard Page </p>
  </div>
</form>
<p></p>

Thanks in advance!Really need your help.. :)

Hiiii,,,check this:

<?php
$con = mysql_connect("localhost","root","root");
if (!$con)  {  die('Could not connect: ' . mysql_error());  } 
mysql_select_db("pqs", $con);
$ref1 = $_POST['$ref1'];
$result = mysql_query("SELECT * FROM userdb WHERE User_tcno = '$ref1' LIMIT 0, 1",$con);
?> 
<form name="form1" method="post" action="view_user.php">  <p>&nbsp;</p>  
 <?php 
while($row = mysql_fetch_array($result))				
{ ?>   

<table width="545" border="0" align="center" bordercolor="#F0F0F0">
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th width="196" scope="col"><div align="right" class="style9">User TC No. </div></th>
      <th width="5" scope="col"><div align="center"><strong>:</strong></div></th>
      <th width="330" scope="col"><div align="left"><?php echo $row['User_tcno']; ?></div></th>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">User Name </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_name']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Department</div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_dep']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Access Username </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_username']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th scope="row"><div align="right" class="style9">Access Password </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_passsword']; ?></div></td>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th height="24" scope="row"><div align="right" class="style9">Access Level </div></th>
      <td><div align="center"><strong>:</strong></div></td>
      <td><div align="left"><?php echo $row['User_level']; ?></div></td>
    </tr>

	  <?php }?>

    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th colspan="3" scope="row"><div align="right"></div></th>
    </tr>
    <tr bordercolor="#F0F0F0" bgcolor="#FFFFFF">
      <th height="44" colspan="3" scope="row"><div align="center">
	  
        <input name="print" type="submit" id="print" value="Print" onclick="window.print();" /> 
		<input name="close" type="submit" id="close" value="Close" onclick="" />
		 </a>
      </div></th>
    </tr>
  </table>

 <?php mysql_close($con);?> 
  <p>&nbsp;</p>  <div id="footer">   
 <p align="left"><strong>Access Level description:</strong><br />      Level 1   : Admin page<br />      Level 2	: HRA page<br />      Level 3	: Guard Page </p>  </div></form>

%^^%Murtada%^^%

Its not working.Still cannot view.
Can I know $ref1 = $_POST; refer to what?
And is it this User_tcno = '$ref1' must refer to primary key in table?
Anyone can help me? :(

$result = mysql_query("SELECT id,column1,column2,column3 FROM userdb WHERE id = '".$ref1."'");
$row = mysql_fetch_row($result);
echo $row[column1];
echo $row[column2];
echo $row[column3];

$ref1 = $_REQUEST['$ref1'];

Where did you pass value for ref1? I think through query string. If so replace your above line with this

$ref1 = $_REQUEST['ref1'];

Thank you decade!Its work! :)

Thank you Khartik :)

OK... Mark this thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.