leon Posted April 9, 2006 Share Posted April 9, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/ Share on other sites More sharing options...
ToonMariner Posted April 9, 2006 Share Posted April 9, 2006 use php and mysql to generate the html for the page. use javascript for any 'interaction' that you want to do - such as roll overs.document effects are client side matters while php and mysql deals with serverside things. Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25242 Share on other sites More sharing options...
SomeGuy1337 Posted April 9, 2006 Share Posted April 9, 2006 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 Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25245 Share on other sites More sharing options...
Vorotaev Posted April 9, 2006 Share Posted April 9, 2006 [!--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.] Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25249 Share on other sites More sharing options...
leon Posted April 9, 2006 Author Share Posted April 9, 2006 [!--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] Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25256 Share on other sites More sharing options...
kenrbnsn Posted April 9, 2006 Share Posted April 9, 2006 You can use PHP & MySql to build the javascript which is later run by the browser.Ken Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25260 Share on other sites More sharing options...
Vorotaev Posted April 9, 2006 Share Posted April 9, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25262 Share on other sites More sharing options...
ToonMariner Posted April 9, 2006 Share Posted April 9, 2006 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 Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25263 Share on other sites More sharing options...
leon Posted April 9, 2006 Author Share Posted April 9, 2006 [!--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. Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25266 Share on other sites More sharing options...
SomeGuy1337 Posted April 10, 2006 Share Posted April 10, 2006 i would [b]strongly[/b] advise you to conquer html+css before you move onto phpjavascript 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. Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25407 Share on other sites More sharing options...
leon Posted April 10, 2006 Author Share Posted April 10, 2006 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... Quote Link to comment https://forums.phpfreaks.com/topic/6952-rollover-image-with-php-and-mysql/#findComment-25481 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.