Page 1 of 1

Displying Data

Posted: Wed Jul 14, 2004 7:41 am
by petenyce107
I am trying to display my search results in text boxes. Easy right? But im having a problem with my PHP Heres my code any help would be great?




?

Code: Select all

$searchtype =$HTTP_POST_VARS['searchtype'];
$searchterm =$HTTP_POST_VARS['searchterm'];

$conn = mysql_connect("localhost","Admin"."Admin");
mysql_select_db("test",$conn);

$sql= "select ProviderName,Dos,To_Dos,Billed,Status from info where Surname like '".$searchtype."'and Dob = '".$searchterm."'";

$result=mysql_query($sql,$conn) or die(mysql_error()); 
$numrs = mysql_num_rows($result);
if ($numrs == 0) 
{
        echo '<font color="Black"><b>Please try your search again</b></font></br></br>';
	echo '<font color="red">No matching records.</br></br>';
        echo '<a href ="claim-lookup.html"><font color="black">Back</font></a>';
exit;
}     
echo '<font color="Black"><b>Records Found:</font><font color="red">'.strtoupper($numrs).'</p>';

		
                        ?>
      </td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="19">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
      &nbsp;</td>
      <td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
      &nbsp;</td>
      <td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;&nbsp;&nbsp; </td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
      &nbsp;</td>
      <td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <font face="Times New Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font></td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="7" bordercolor="#477678">
      &nbsp;</td>
      <td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="7">
      &nbsp;</td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="7">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
      &nbsp;</td>
      <td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      <td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="6" bordercolor="#477678">
      &nbsp;</td>
      <td width="680" align="left" bgcolor="#FFFFFF" valign="top" height="6" colspan="2">
      &nbsp;</td>
      </tr>
      <tr>
      <td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
      &nbsp;</td>
      <td width="680" align="left" bgcolor="#FFFFFF" valign="top" height="1" colspan="2">
      &nbsp;</td>
      <td width="9" align="left" bgcolor="#FFFFFF" valign="top" height="1">
      &nbsp;</td>
      </tr>
      </table>
      </center>
      </div>
    </td>
  </tr>
  </table></center>
</div>
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="57%" height="16">
    <tr>
      <td width="100%" height="12" bgcolor="#008080">
      <p align="center"><font size="2"><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; View our </font>
      <a href="l"><font color="#FFFFFF">Privacy Policy</font></a><font color="#FFFFFF"> 
      for information on how we protect your privacy. </font></font></td>
    </tr>
    <tr>
      <td width="100%" height="3" bgcolor="#008080">
      <p align="center"><font face="Arial" size="1" color="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copyright 
      © 2000-2003 by Electronic Health Plans, Inc. All rights reserved</font></td>
    </tr>
  </table>
  </center>
</div>

Posted: Wed Jul 14, 2004 7:51 am
by Buddha443556
First could you use [ php] code thingy in your post please then maybe expand on the problem a bit?

Posted: Wed Jul 14, 2004 8:04 am
by Buddha443556
Just guessing but is this what your sort of looking for?

Code: Select all

<?php while( $whatever = db_fetch_assoc( $result ) ) { ?>
<input type="text" name="ProviderName" size=75 value="<?php echo @$whatever['ProviderName']; ?>">
<?php } ?>
You'll need to fill that out with the other fields.

reply

Posted: Wed Jul 14, 2004 8:27 am
by petenyce107
ok im getting the error message

Fatal error: Call to undefined function: db_fetch_assoc() in c:\inetpub\wwwroot\results.php on line 38


<?php while( $whatever = db_fetch_assoc( $result ) ) { ?>
<input type="text" name="ProviderName" size=75 value="<?php echo @$whatever['ProviderName']; ?>">
<?php } ?>


im trying to display my results in text boxes...???

Posted: Wed Jul 14, 2004 8:39 am
by Buddha443556
Whoops... sorry coded that for my database abstraction layer.

Try...

Code: Select all

<?php while( $whatever = mysql_fetch_assoc( $result ) ) { ?>
<input type="text" name="ProviderName" size=75 value="<?php echo @$whatever['ProviderName']; ?>">
<?php } ?>

Posted: Wed Jul 14, 2004 8:51 am
by petenyce107
ok heres my PHP and its not working to well im going to highlight the problem area


<?


$conn = mysql_connect("localhost","Admin"."Admin");
mysql_select_db("test",$conn);

$sql= "select Id,ProviderName,Dos,To_Dos,Billed,Status from info where Surname like '".$searchtype."'and Dob = '".$searchterm."'";

$result=mysql_query($sql,$conn) or die(mysql_error());
$numrs = mysql_num_rows($result);
if ($numrs == 0)
{
echo '<font color="Black"><b>Please try your search again</b></font></br></br>';
echo '<font color="red">No matching records.</br></br>';
echo '<a href ="claim-lookup.html"><font color="black">Back</font></a>';
exit;
}
echo '<font color="Black"><b>Records Found:</font><font color="red">'.strtoupper($numrs).'</p>';
print"<center>
<table border = 1 bordercolor=\"#000000\" cellpadding=\"0\" cellspacing=\"0\" width=\"700\">\n";

print "<tr>\n";
while ($field = mysql_fetch_field($result)){
print "<center><th bgcolor=\"#66,99,99\" width=\"87\"><font color=\"#FFFFFF\">$field->name</th>\n";
}
print "</tr>\n\n";

while ($row = mysql_fetch_assoc($result)){
print "<tr>\n";

foreach ($row as $col=>$val){

print "<td width=\"100\" >$val</td>\n";
}
$id = $row['Id'];
print "<td><a href=%22details.php?id=$id/">More details</a></td>\n";
print "</tr>\n\n";
}
print "</table>\n";
while( $whatever = mysql_fetch_assoc( $result ) ) {
<input type="text" name="ProviderName" size=75 value="<?php echo @$whatever['surname'];?>">

}

?>

Posted: Wed Jul 14, 2004 9:54 am
by petenyce107
ok im trying to use this to display my results ina textb box what is wrong with this error

while ($row = mysql_fetch_assoc($result)){
print " <input type=\"text\" name=\"whatevername\" size=\"30\" value=".$row['Id']">";

This isnt working

Posted: Wed Jul 14, 2004 4:27 pm
by johnperkins21
petenyce107 wrote:ok im trying to use this to display my results ina textb box what is wrong with this error

Code: Select all

<?php
while ($row = mysql_fetch_assoc($result)){
print " <input type="text" name="whatevername" size="30" value=".$row['Id']">";
?>
This isnt working
You're missing a period and your quotes are off.

Code: Select all

<?php
while ($row = mysql_fetch_assoc($result)){
print " <input type="text" name="whatevername" size="30" value="".$row['Id']."">";
?>
If you use PHP and Code tags, you'll probably get better and faster responses.

Posted: Wed Jul 14, 2004 4:31 pm
by johnperkins21
Someone might disagree with me on this, but I usually do something like this to make it easier on myself:

Code: Select all

<?php
while ($row = mysql_fetch_assoc($result)){
?>
<input type="text" name="whatevername" size="30" value="<? echo $row['Id'] ?>">
<?
?>