Hi,
Sorry about this, I know it must be frustrating having to answer what is I suppose a basic question, but I just need to be pointed in the right direction and I'll do my best to find a solution myself (it's the only way to learn!)
I'm currently building a site using (dare I say) Dreamweaver, MySQL and the built in PHP functions of DWMX. I know the time has now come for me to start writing my own scripts and need guidance as I don't know what functions/scripts I'll need to write (it may not even be PHP and can be handled in JavaScript?)
I have a page where I review music and video. I have 5 gifs, each with a number of stars relating to the rating I have given the CD/DVD/Video, and want to show the corresponding gif according to the "stars" value (tinyint(1)) in my MySQL table "media".
I understand that there's some sort of condition going on here, e.g. if returned value = 1 then show 1star.gif, if returned value = 4 then show 4star.gif, and so on.
This also looks like an if... then statement, as there is no null value allowed (so therefore I don't need to NOT show an image).
Where do I start?
I understand that an array is a set of values (so for example 1, 2, 3, 4, 5 could be the array of values anticipated, and that "1star.gif", "2star.gif", "3star.gif", "4star.gif" and "5star.gif" comprise the array of images). But, not being a programmer (I'm a photographer), lose sight of how to write a script.
I also understand that I can create the function anywhere on the page (although it's probably best in before the <html> opening tag, as there are two areas of the page that will make a call to this function. And then, at the point of where the image should be displayed I make the call to the function with an arbitrary value (where this comes from I don't know -- is it the value returned from the database?)
Please could someone guide me in the right direction?
Is there a resource out there that's an absolute idiots guide to writing a function and the logic/maths behind it?
Help!!
Thanks for taking the time to read this tome.