what's wrong with code?

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

Post Reply
kenny724
Forum Newbie
Posts: 7
Joined: Sun Jan 31, 2010 3:19 pm

what's wrong with code?

Post 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 = "";
}
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: what's wrong with code?

Post 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.
Post Reply