darphas Posted January 21, 2013 Share Posted January 21, 2013 Hello everybody.. I'm a kind of newbie in php coding. i'm making a online catalog, of my dads company. it's works perfect but in some products i want to show more photos and i cant and when i add one more in a product all the other products appears the problem. i dont know what i can so to solve this problem. please help me. Database: Table: and here is the code that i use to show the images... $result = mysql_query( "SELECT photo_caption,photo_description,photo_code,photo_filename,photo_filename2,photo_filename3,photo_filename4,photo_filename5,photo_filename6 FROM gallery_photos WHERE photo_id='".addslashes($pid)."'" ); list($photo_caption,$photo_description,$photo_code,$photo_filename,$photo_filename2,$photo_filename3,$photo_filename4,$photo_filename5,$photo_filename6) = mysql_fetch_array( $result ); $nr = mysql_num_rows( $result ); mysql_free_result( $result ); if( empty( $nr ) ) { $result_final = "\t<tr><td>There is no Photos</td></tr>\n"; } else { $result = mysql_query( "SELECT category_name FROM gallery_category WHERE category_id='".addslashes($cid)."'" ); list($category_name) = mysql_fetch_array( $result ); mysql_free_result( $result ); $result_final .= " <div class='baseline'> <ul> <li><a href='javascript:history.back()'>Back</a> </li> <li><a href='index.php?pag=gallery'>Categories</a> </li> <li><a href='index.php?pag=ver&cid=$cid'>$category_name</a></li> </ul> <br style='clear:left;'/> </div> "; $result_final .= " <div class='descripcion'> <div id='slides'> <div class='slides_container'> <img src='".$images_dir."/".$photo_filename."' width='640' height='480' border='0' alt='Slide 1'/> <img src='".$images_dir."/".$photo_filename2."' width='640' height='480' border='0' alt='Slide 2'/> <img src='".$images_dir."/".$photo_filename3."' width='640' height='480' border='0' alt='Slide 3'/> <img src='".$images_dir."/".$photo_filename4."' width='640' height='480' border='0' alt='Slide 4'/> <img src='".$images_dir."/".$photo_filename5."' width='640' height='480' border='0' alt='Slide 5'/> <img src='".$images_dir."/".$photo_filename6."' width='640' height='480' border='0' alt='Slide 6'/> </div> <a href='#' class='prev'><img src='img/prev.png' width='28' height='44' alt='Arrow Prev'></a> <a href='#' class='next'><img src='img/next.png' width='28' height='44' alt='Arrow Next'></a> </div> <div class='textodesc'> <h2>$photo_caption</h2> <p><b></br></b>$photo_description</p> </div></div> "; } } and this is how appears in the browser Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 21, 2013 Share Posted January 21, 2013 You need to denormalize that data. If you want to keep it the way it is and get help, you should probably explain "the problem". Quote Link to comment Share on other sites More sharing options...
darphas Posted January 21, 2013 Author Share Posted January 21, 2013 ok the problem is if i try to add andother row in the table.. all the other products have too an other space. and i only want to add more photho in a specific products but i dont know how i can make this change in that mini system. thanks for your reply jessica. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 21, 2013 Share Posted January 21, 2013 I think you are saying when you try to add another column. Which brings me back to the fact that you *need* to denormalize the data. Each photo should be in it's own row in a table that stores photo file names and product ids. Quote Link to comment 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.