Page 1 of 1

what's wrong with code?

Posted: Sun Oct 09, 2011 2:37 pm
by kenny724
There are several lines that need a signature inserted. What is wrong with this code? Trying to insert md signature in the field and therapist signature in the field. Thanks.

Code: Select all

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 <br />";
	$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];
	$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $therapist_id_fk";
	$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];
	
	//echo "sig: $md_sig <br />";
	$md_name_string = "$sql_array[1] $sql_array[2]";
	$therapist_name_string = "$sql_array[1] $sql_array[2]";
	if(file_exists($md_sig))
	{
		$md_sig = "<img src=\"$md_sig\" border=\"0\" alt=\"\" />";
		$therapist_sig = "<img src=\"$therapist_sig\" border=\"0\" alt=\"test\" />";
	}
	
	else
	{
		$md_sig = "<br /><br /><br />";
		$therapist_sig = "<br /><br /><br />";
	}	
	//now clean up the date format
	$approved_date_string = strftime("%m/%d/%Y", strtotime($approved_date));
}
else
{
	$md_sig = "<br /><br /><br />";
	$md_name_string = "";
	$approved_date_string="";
	$therapist_sig = "<br /><br /><br />";
	$therapist_name_string = "";
}

Re: what's wrong with code?

Posted: Sun Oct 09, 2011 6:02 pm
by califdon
To get someone to answer your questions, explain what is not working correctly, then how you want it to work. Remember, we are not at your side, observing what is happening, we don't like to just guess. If you are getting any error messages, show us the exact error message. Finally, when you post code, please use the "PHP Code" button at the top of your composing box, this will format the code so it is much easier for us to read, and will attract the attention of more people. Then we should be able to help you.