Jump to content

linking an image to a database query...?


jerryco

Recommended Posts

Hi im new to the forum and am after a solution to my problem and how to go about it? I am in the process of building a site in php but am requiring a speedo type dial image which would possibly change on the out come of a database query if this make sense..  Basically the site user would submit a form which in turn would write name, region  a £ amount to the mysql database table, this in turn would tot up with all the other entries of the day and display the cost savings on the said speedo type gauge, then a news type ticker to display ('name' from 'region' saved'£xxx') which would scroll with the say last ten entries  and then if possible an extra text box to display 'totals saved to date' which would add all the submissions to date. Hope this is possible  and someone could spread some light on ho to go about doing it. :confused:

Link to comment
Share on other sites

speedo type dial image

That puts all kind of weird images in my head...

 

 

The database design sounds quite simple. You'll want two tables: one for regions and one for these savings. The regions table is so that you don't have to try to parse or format or recognize names that people enter - they just pick one from a list. The table provides that list. The savings table has columns for a date, the user's name, a foreign key to the regions table (to identify the region), and an amount in pounds. Querying those tables is also very easy and can provide everything you've mentioned.

 

But what's a "speedo type dial image" and a "speedo type gauge"?

Link to comment
Share on other sites

Thanks for the quick reply.. and sorry for not being clear. The image would be a graphic of a car speedometer and the needle would rise and fall depending on the value saved on the given day. The totals saved would be the mileometer within this.. thanks.

Link to comment
Share on other sites

Thanks for the replies  well my thoughts were that i could save say six images of the speedometer with the needle indicator in a different place then depending on the database value it could somehow display one of the images? obviously it ould be magic if i could incorporate say jquery for a smooth rising needle on the gauge but this not essential. 

Link to comment
Share on other sites

For a static image the basic strategy is to draw the needle on top of a background image. Depending on the needle the drawing can be easy or difficult.

 

For a rising needle, look to canvas/SVG first using the same basic "drawing a needle on top" idea. Those can handle it quite easily and should cover most browsers. It would also mean you could, say, fire off occasional AJAX queries to see how the figure has changed since it was first loaded and move the needle accordingly.

 

On a different note:

IMO a speedometer doesn't quite have the same connotations of saving money: one is about going faster while the other is about spending slower. It's the same way a thermometer wouldn't be appropriate: rising temperatures versus falling costs (not to mention that thermometers are most often used in fundraising-type situations).

If you'd like more ideas could you describe what these people are saving money on?

Link to comment
Share on other sites

Ok cool so i could fire up illustrator for a svg and use this? i can do the layers etc and create the image/s but hat i would struggle with is putting it all together to make it function as intended.. this is the area i fall down  :( again thanks for any help..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.