On Jun 11, 2:33*pm, The Natural Philosopher <a...@b.cwrote:
sumithar wrote:
I have a php application which has a page where some personal details
can be updated. *One of the details is a photo.
The backend is mysql.
My question has to do with how best to code for this. *Since the image
is not changed often, do I have 2 mysql update statements in the code?
Something like this
*$var1 = $_FILES['photo']['name'];
*if ($var1)
* * * * * { *sql update statement that includes the photo column as
well}
*else
* * * * * {sql update statement that doesn't include the photocolumn}
Is there another approach to accomplish this?
I update images entirely sperately, depending on whether the $_FILES
array has anything in it.
Its easy enough to check
Thanks all!
Actually in my initial SELECT to display the values on the form, I
don't include the photo column. I have a separate database call for
that like so:
<img src="dispphoto.php?id="<?php echo $player_id; ?>"" width="80"
height="60">
And dispphoto.php just SELECTs the photo column from the table and
"echo"es it.
Captain- sorry you lost me completely. Dynamic SQL was taboo in the
world I come from ;-)
Jerry- I have just a nodding acquaintance w/ OO-PHP. Are you
suggesting the use of some Object-Relational mapper tool? My java
developer friends use something called Hibernate. Is that what you
are talking about?
Doing the update of image alone as a separate statement looks a good
option based on whether the $_FILES has a value in it. Better than 2
long update statements. Though it will be one DB call extra but this
is a low volume environment.