MySQL Forums
Forum List  »  Newbie

help with code
Posted by: Kenneth Hunt
Date: October 06, 2011 01:42PM

Can someone help? I'm trying to learn and support php/sql database. Someone else programmed this. There is a patient whose form is not populating with the data from the older form, however the others are populating. What could cause this?

Also, there are several fields that have places for signatures. If the dr. signs it, how would all the other lines populate with the other signatures? Where would I need to look or what would I need to add? Thanks for any help.

Confused.

Here is the form code. There are several lines with the signatures. What needs to happen is when the md signs it, the other fields need to populate with the signatures. Can someone help with this? Thanks.

<?php

// Include this file to add signatures to the print output
// This file will set two signature variables: md_sig and clinician_sig

//first step is to use the query results from the cpt_form.inc for the billed_by var
if(IsSet($billed_by))
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $billed_by";
else
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $completed_by_fk";
//echo "clinician_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$clinician_sig = $sql_array[0];
$clinician_name_string = "$sql_array[1] $sql_array[2]";

if(file_exists($clinician_sig))
$clinician_sig = "<img src=\"$clinician_sig\" border=\"0\" />";
else
$clinician_sig = "


";

//now clean up the date format
if(IsSet($completed_date))
$completed_date_string = strftime("%m/%d/%Y", strtotime($completed_date));
else
$completed_date_string="";

if(IsSet($approved_by) && $approved_by != "")
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $approved_by";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$md_sig = $sql_array[0];
//echo "sig: $md_sig
";
$md_name_string = "$sql_array[1] $sql_array[2]";

if(file_exists($md_sig))
{
$md_sig = "<img src=\"$md_sig\" border=\"0\" alt=\"\" />";
}

else
{
$md_sig = "


";
}
//now clean up the date format
$approved_date_string = strftime("%m/%d/%Y", strtotime($approved_date));
}
else
{
$md_sig = "


";
$md_name_string = "";
$approved_date_string="";
}

if(IsSet($psychiatrist_id_fk) && $psychiatrist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $psychiatrist_id_fk";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$psychiatrist_sig = $sql_array[0];
$psychiatrist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($psychiatrist_sig))
$psychiatrist_sig = "<img src=\"$psychiatrist_sig\" border=\"0\" alt=\"test\" />";
else*/
$psychiatrist_sig = "


";
}
else
{
$psychiatrist_sig = "


";
$psychiatrist_name_string = "";
}

if(IsSet($therapist_id_fk) && $therapist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $therapist_id_fk";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$therapist_sig = $sql_array[0];
$therapist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($therapist_sig))
$therapist_sig = "<img src=\"$therapist_sig\" border=\"0\" alt=\"test\" />";
else*/
$therapist_sig = "


";
}
else
{
$therapist_sig = "


";
$therapist_name_string = "";
}

if(IsSet($activity_therapist_id_fk) && $activity_therapist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $activity_therapist_id_fk";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$activity_therapist_sig = $sql_array[0];
$activity_therapist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($activity_therapist_sig))
$activity_therapist_sig = "<img src=\"$activity_therapist_sig\" border=\"0\" alt=\"test\" />";
else*/
$activity_therapist_sig = "


";
}
else
{
$activity_therapist_sig = "


";
$activity_therapist_name_string = "";
}

if(IsSet($case_manager_id_fk) && $case_manager_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $case_manager_id_fk";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$case_manager_sig = $sql_array[0];
$case_manager_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($case_manager_sig))
$case_manager_sig = "<img src=\"$case_manager_sig\" border=\"0\" alt=\"test\" />";
else*/
$case_manager_sig = "


";
}
else
{
$case_manager_sig = "


";
$case_manager_name_string = "";
}


if(IsSet($other_id_fk) && $other_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $other_id_fk";
//echo "md_sig: $sql_query
";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$other_sig = $sql_array[0];
$other_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($other_sig))
$other_sig = "<img src=\"$other_sig\" border=\"0\" alt=\"test\" />";
else*/
$other_sig = "


";
}
else
{
$other_sig = "


";
$other_name_string="";
}

?>

Options: ReplyQuote


Subject
Written By
Posted
help with code
October 06, 2011 01:42PM
October 06, 2011 03:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.