PHP - MySQL optimization<

liunx

Guest
I'am optimazing a PHP-MySQL code.

Want 2 hear ur opinion and help.

1. I changed all "SELECT * FROM" sql to "SELECT f1, f2, ... , fn FROM"

2. Changed all mysql_fetch_object to mysql_fetch_row

But found this code, I think it is way to convert $html_body to a sort of binary form, by writing it to a file and then reading it from:


$real_path = realpath(".");

$ffpath=$real_path ."/temp/temp".rand().".txt";
$fp = fopen ($ffpath, "w");
$rr=@fwrite($fp,$html_body);
fclose($fp);
$fp = fopen ($ffpath, "r+");
$lines = @file($ffpath);
$num_lines = count ($lines);


$msg_bodyhtml="";
for($ii=0;$ii<$num_lines;$ii++)
{
$msg_bodyhtml .= $lines[$ii];
}
fclose($fp);
$uu= unlink($ffpath);

//$msg_bodyhtml = $msgbody_html;

$html_body = $msg_bodyhtml;


Don't understand why is needed. (Of course the msgbody_html; is the body of an email message to be send bellow)

Want 2 know ur opinion of the cahnges I made and if u understand thsi code a help me to find a simpler function to do the converssion.

Thanks,

RodolfoI don't understand why it is needed either. looks to me they open a file, write to it, opens it again, reads from it, sticks it in another variable then deleted the file. a lot of wasted code if you ask me.

why are you making this send html email so hard? you don't have to do anything to the email to sned in in html but send the correct header.

also mysql_fetch_array()is a lot better than mysql_fetch_row()Thanks Scoutt:

I didn't make this code, I am just optimizing it. So I will remove this piece of code.

And change to mysql_fetch_array();

Thanks alot
 
Back
Top