Re: Does PHP have an end-of-file problem.
- From: "Curtis" <dyer85@xxxxxxxxx>
- Date: 30 Dec 2006 16:44:59 -0800
Your coding style reminded me of C for some reason (nothing wrong with
that, just an observation).
Good luck with your site,
Curtis
On Dec 29, 3:49 pm, George Webb <nom...@xxxxxxx> wrote:
Curtis, no I'm not a programmer, just someone trying to put a database
on my web site. I do however appreciate your input and will amend my
script accordingly. Many thanks.
GW.
Curtis wrote:
Just curious, but George, have you programmed in C or C++ before?
For what it's worth, here are some things you can do to increase
performance a bit. In PHP, strings do not need to have double quotes
unless they contain variables or whitespace metacharacters like \t, \n,
\r, etc. If you switch to single quotes, the PHP interpreter won't
execute variable interpolation on strings on which it's not needed.
if (!$mysql=mysql_connect($host, $user, $password)) {
printf("Connect failed: %s\n", mysql_connect_error());
exit();
mysql_close($mysql);Not related to performance, but after exit() is called, nothing is
}
executed, so there's no need to close the connection, unless you do it
before. At the very least, you'll get rid of a couple extra lines :P
You also call mysql_fetch_array, which generates two arrays, one
indexed, and one associative array (hash, dictionary, etc.). If you
call mysql_fetch_assoc() instead, you'll also save some time.
I guess this wouldn't affect you too much, unless you had an enormous
amount of data to sort through.
Curtis
.
- References:
- Does PHP have an end-of-file problem.
- From: George Webb
- Re: Does PHP have an end-of-file problem.
- From: adlerweb
- Re: Does PHP have an end-of-file problem.
- From: George Webb
- Re: Does PHP have an end-of-file problem.
- From: no
- Re: Does PHP have an end-of-file problem.
- From: George Webb
- Re: Does PHP have an end-of-file problem.
- From: Curtis
- Re: Does PHP have an end-of-file problem.
- From: George Webb
- Does PHP have an end-of-file problem.
- Prev by Date: Re: How to build a web application the right way
- Next by Date: Re: HELP ! ! ! something simple . . . :D
- Previous by thread: Re: Does PHP have an end-of-file problem.
- Next by thread: Re: Does PHP have an end-of-file problem.
- Index(es):
Relevant Pages
|