Jump to content

rollover image with php and mysql


leon

Recommended Posts

Hello guys, I am new to php and mysql and i wanna use rollover images on my website. I created the codes for rollover image using dreamweaver but I can not estimate what do i need to do with mysql and php. Basically , I designed an html site using these images and tried to change the <img src> and rollover sections with the php codes but it was not useful. I hope it is clear. Can you help me?
Link to comment
Share on other sites

your oviously very inexpiraneced with progrmaing, which is fine, thats why your hear asking questoins.

i am not sure what you are trying to do, you need to be more clear.

i think you want it that when you press the roll over button to goto a section on your site you want php and mysql to show that content when you press the button?

you will have to be more sepcific before anyone can offer any usefull advice.
Link to comment
Share on other sites

[!--quoteo(post=363028:date=Apr 9 2006, 01:00 PM:name=SomeGuy1337)--][div class=\'quotetop\']QUOTE(SomeGuy1337 @ Apr 9 2006, 01:00 PM) [snapback]363028[/snapback][/div][div class=\'quotemain\'][!--quotec--]
your oviously very inexpiraneced with progrmaing, which is fine, thats why your hear asking questoins.

i am not sure what you are trying to do, you need to be more clear.

i think you want it that when you press the roll over button to goto a section on your site you want php and mysql to show that content when you press the button?

you will have to be more sepcific before anyone can offer any usefull advice.
[/quote]
Technically it's scripting as opposed to programming. He wants to use a basic rollover; the image changes when you put the mouse on it. He wants to do so with PHP and MySQL, however, which isn't possible for the reasons explained by ToonMariner.

A rollover with Javascript is as simple as:

[code]<img src="pic.jpg" onmouseover="this.src='new.jpg';" onmouseout="this.src='pic.jpg';">[/code]

[Fixed the quotes.]
Link to comment
Share on other sites

[!--quoteo(post=363032:date=Apr 9 2006, 05:41 PM:name=Vorotaev)--][div class=\'quotetop\']QUOTE(Vorotaev @ Apr 9 2006, 05:41 PM) [snapback]363032[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Technically it's scripting as opposed to programming. He wants to use a basic rollover; the image changes when you put the mouse on it. He wants to do so with PHP and MySQL, however, which isn't possible for the reasons explained by ToonMariner.

A rollover with Javascript is as simple as:

[code]<img src="pic.jpg" onmouseover="this.src='new.jpg';" onmouseout="this.src='pic.jpg';">[/code]

[Fixed the quotes.]
[/quote]

Thanks for your replies. Actually i want to make my site dynamic with php and mysql, But i have problems with the rollover image.here is the address;

[a href=\"http://www.ionicstone.com/tiles.htm\" target=\"_blank\"]http://www.ionicstone.com/tiles.htm[/a]
Link to comment
Share on other sites

OK, now I'm confused too as to what you want the rollover to do. If you want the full sized picture to appear on the left when the mouse is placed over the thumbnail, you'd use:

[code]// The full size image.
<img id="imgfull" src="tile1_full.jpg">

// A sample thumbnail.
<img src="tile2_thumb.jpg" onmouseover="imgfull.src='tile2_full.jpg';">[/code]
...as an example.
Link to comment
Share on other sites

Not wanting to re-invert your wheel but I am a great proponent of accessibility on websites...

Have you considered using css to do this? It means no javascript (so it doesn't matters if the visitor has js turned off) and you have an opportunity for visually imparied users to have their screen readers not have to deal with messy img tags!!!

take a look at www.regeneratingnb.co.uk and the associated css file (you will have to spend a bit of time if you are not familiar with class and id attributes and how to use them in css)
Link to comment
Share on other sites

[!--quoteo(post=363046:date=Apr 9 2006, 06:19 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 9 2006, 06:19 PM) [snapback]363046[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Not wanting to re-invert your wheel but I am a great proponent of accessibility on websites...

Have you considered using css to do this? It means no javascript (so it doesn't matters if the visitor has js turned off) and you have an opportunity for visually imparied users to have their screen readers not have to deal with messy img tags!!!

take a look at www.regeneratingnb.co.uk and the associated css file (you will have to spend a bit of time if you are not familiar with class and id attributes and how to use them in css)
[/quote]

Thank you but, before css I need to learn php and mysql efficiently. I just thought it 'd be easier to use javascript for this because dreamweaver generates the code already, but because of my lack of knowledge, it turns into mess. I tried something like this but it doesnt help.By the way where to add script language='javascript' and </script> things while using php. ?

[code]<img src="<?php $data['image'] ?> onmouseover=<?php $data['image_roll']; ?>> alt="<?php echo $data['alt']; ?>" width="102" height="80" ....[/code]

Wow I liked this forum, everyone tries to help, I'm impressed.Thanks guys.
Link to comment
Share on other sites

i would [b]strongly[/b] advise you to conquer html+css before you move onto php

javascript is interpreted by the browser just as css and html is,
php is processed by the server.
any php code is only see by teh server and not the browser, which means its also secure.
javascript it used to dynamicly control the the page after its already been loaded.

dreamweaver shud be able to make you all teh rollover code and allow you just to specifiy which images to use.
Link to comment
Share on other sites

Yes, I think I will go for css rollover image. I realized that it only has a few line codes so that i can manage them efficiently. Thanks for your help. Let me search some examples for rollovers on the Net...
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.