473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Need to show the larger image when user clicks on the small image using database

hello,

Can any one please tell me

I am Using php,Mysql,CSS to build my site

In my database i have small images and large images
i am show the small images to the right of the main container now i need to show the large image to left side when user clicks on these small images
but when i click on the images it is showing the large image in the new browser

hope u understand my problem
please tell me what wrong am i doing

here is my code
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>                                        
  6.  
  7. <style type="text/css">
  8. #container
  9. {
  10.     float:left;
  11.     border:5px solid #666;  
  12.     position:relative; 
  13.     width:770px; 
  14.     height:450px; 
  15.     margin:20px auto 0 100px;
  16.     top:-20px;
  17. }
  18.  
  19. .styles
  20. {
  21.     text-align:center;
  22.     margin:190px 390px 0px 20px;    
  23. }
  24. #container1
  25. {
  26.     float:right;
  27.     border:1px solid #9F0;
  28.     padding:3px;
  29.     height:445px; 
  30.     width:355px;
  31.     margin:-250px 0px 0px 0px;
  32. }
  33. .yourstyle
  34. {
  35. position:absolute;
  36. left:0px;
  37. top:-2px;
  38.  
  39. }
  40.  
  41.  
  42. </style>            
  43.  
  44. </head>
  45.  
  46. <?php
  47.            function connect()
  48.            {
  49.               $dbhost='aaa';
  50.               $dbuser='aa';
  51.               $dbpass='aaa';
  52.               $conn= mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'.mysql_error());
  53.               $dbname='hakman';
  54.               mysql_select_db($dbname);
  55.               return $conn;
  56.            }
  57. ?>
  58.  
  59. <body bgcolor="#0a1936" >
  60.  
  61. <div id="container">
  62.  
  63. <p class="styles"><font color="#FFFFFF" face="Monotype Corsiva" size="+2">
  64.  
  65. Image should be shown here when user clicks
  66.  
  67. </font></p>
  68.  
  69.  
  70.  
  71.  
  72. <?php 
  73. $c=connect(); 
  74. $query2="select style from styles"; 
  75. $sql=mysql_query($query2); 
  76. $result2=mysql_num_rows($sql);  //25
  77.  
  78. $query="select path from styles "; //0 to 6
  79. $result=mysql_query($query);                                    
  80.  
  81. $query1="select big_img from styles "; //0 to 6
  82. $result1=mysql_query($query1);                                    
  83.  
  84. $query3="select style,path from styles ";
  85. $result3=mysql_query($query3); 
  86.  
  87. ?>
  88.      <div id="container1">
  89.                  <?php
  90.                         echo '<table border="1" align="right" width="50px" height="375px" BORDERCOLOR="#9F0">'; 
  91.                         for($r=1;$r<=4;$r++) 
  92.                         { 
  93.                             echo '<tr>'; 
  94.                             for($d=1;$d<=2;$d++) 
  95.                             { 
  96.                                  $obj=mysql_fetch_object($result);
  97.                                  $obj1=mysql_fetch_object($result1);
  98.                                  $obj2=mysql_fetch_object($sql);    
  99.                                  $obj3=mysql_fetch_object($result3);
  100.                                  $imageSrc=$obj->path; 
  101.                                  $cimage="/images/".$obj->path; 
  102.                                  $big="/images/".$obj1->big_img; 
  103.                                  $styl=$obj3->style; 
  104.                                  $sty2=$obj3->style; 
  105.  
  106.             echo '<td><a title="'.$styl.'" href="'.$big.'" id="'.trim($sty2).'"><img width="170px" height="100px" src=" ' . $cimage . ' " /></a></td>'; 
  107.  
  108.                  ?>       
  109.       </div>            
  110.        <div class="yourstyle" id="<?php echo trim($sty2).'-big'?>"></div>     
  111.  
  112.                  <?php 
  113.  
  114.  
  115.       }       
  116.       echo '</tr>';
  117.     } 
  118. echo'</table>';?>
  119.  
  120.   </div>
  121.  
  122.   ?>       
  123.  
  124. </body>
  125. </html>
  126.  
Dec 18 '08 #1
1 2483
clain
79
you need to post the code which triggers the onclicik function. there is something wrong with your java script. This forum deals with HTML and Please move the post to an appropriate forum such as PHP or JavaScript

can you post the whole code?
Dec 19 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing...
2
by: Stevio | last post by:
In my web page I preload images so that when a user clicks on a part of the image, the image changes. The images are used to display 4 tabs. Each image shows a different tab as highlighted. If a...
1
by: jdapro | last post by:
Hi - thanks for reading this out there! I'll be quick about it: I've got this row of images (in the end there will be more rows of pics as well). When a user clicks on the image, I want a new...
8
by: Tim Geiges | last post by:
Since I am being challenged with learning c# I figured I could pass some of the pain on to you guys :-) I have another question(this one is important for me to fix before I can get my app to Beta)...
5
by: HSP | last post by:
hi. i need to restore an old database. The db was backed up using a DLT drive, using 2 volumes. The content for the tapes was copied to file onto Solaris machine using rsh and dd (for backup...
4
by: Michael C | last post by:
It seems that no matter how I load a bitmap into memory it remains attached to whatever I used to create it. If I obtained the bitmap from a file the file stays locked or if it came from a stream I...
2
by: Beemer Biker | last post by:
I have a 10 row (per page) gridview where the first column is a small image under 100x200px and the second column is a DropDownList template that selects which image to show in the first column. ...
3
by: swetha123 | last post by:
hello, Can any one please tell me I am Using php,Mysql,CSS to build my site In my database i have small images and large images i am show the small images to the right of the main container...
0
by: zeckdude | last post by:
Hi, I am having some issues with my site. I have a main Nav with four links that load in 4 different sections. You can see the page I am working on here:...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.