PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
petenyce107
Forum Newbie
Posts: 4 Joined: Wed Jul 14, 2004 7:41 am
Post
by petenyce107 » Wed Jul 14, 2004 7:41 am
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">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
</td>
<td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
<td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
</td>
<td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
<td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
</td>
<td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
<font face="Times New Roman"> </font></td>
<td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="7" bordercolor="#477678">
</td>
<td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="7">
</td>
<td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="7">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
</td>
<td width="627" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
<td width="8" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="6" bordercolor="#477678">
</td>
<td width="680" align="left" bgcolor="#FFFFFF" valign="top" height="6" colspan="2">
</td>
</tr>
<tr>
<td width="1" align="left" bgcolor="#FFFFFF" valign="top" height="1" bordercolor="#477678">
</td>
<td width="680" align="left" bgcolor="#FFFFFF" valign="top" height="1" colspan="2">
</td>
<td width="9" align="left" bgcolor="#FFFFFF" valign="top" height="1">
</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"> 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"> Copyright
© 2000-2003 by Electronic Health Plans, Inc. All rights reserved</font></td>
</tr>
</table>
</center>
</div>
Buddha443556
Forum Regular
Posts: 873 Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 » Wed Jul 14, 2004 7:51 am
First could you use [ php] code thingy in your post please then maybe expand on the problem a bit?
Buddha443556
Forum Regular
Posts: 873 Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 » Wed Jul 14, 2004 8:04 am
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.
petenyce107
Forum Newbie
Posts: 4 Joined: Wed Jul 14, 2004 7:41 am
Post
by petenyce107 » Wed Jul 14, 2004 8:27 am
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...???
Buddha443556
Forum Regular
Posts: 873 Joined: Fri Mar 19, 2004 1:51 pm
Post
by Buddha443556 » Wed Jul 14, 2004 8:39 am
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 } ?>
petenyce107
Forum Newbie
Posts: 4 Joined: Wed Jul 14, 2004 7:41 am
Post
by petenyce107 » Wed Jul 14, 2004 8:51 am
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'];?>">
}
?>
petenyce107
Forum Newbie
Posts: 4 Joined: Wed Jul 14, 2004 7:41 am
Post
by petenyce107 » Wed Jul 14, 2004 9:54 am
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
johnperkins21
Forum Contributor
Posts: 140 Joined: Mon Oct 27, 2003 4:57 pm
Post
by johnperkins21 » Wed Jul 14, 2004 4:27 pm
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.
johnperkins21
Forum Contributor
Posts: 140 Joined: Mon Oct 27, 2003 4:57 pm
Post
by johnperkins21 » Wed Jul 14, 2004 4:31 pm
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'] ?>">
<?
?>