haris244808 Posted December 31, 2011 Share Posted December 31, 2011 ok here is the portfolio.php page where it shows from db pictures ordered by 'formid'. When i click to a picture i want me to send to the portofolio_single.php page and show datas (name, date_added, title, etc) of that picture. when i click another picture from portfolio.php send me to the same php and echo different datas (datas of another picture) I wrote to h ref=portfolio_single.php?sid=<?php echo formid?> and trying to get that from portfolio_single.php with sessio. and then show datas but it doesnt work. anyone knows how to do this? Here is portfolio.php: <?php require_once('Connections/ecommerce_dbcon.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_ecommerce_dbcon, $ecommerce_dbcon); $query_portofolioPicRec = "SELECT picture FROM `form` ORDER BY formid DESC"; $portofolioPicRec = mysql_query($query_portofolioPicRec, $ecommerce_dbcon) or die(mysql_error()); $row_portofolioPicRec = mysql_fetch_assoc($portofolioPicRec); $totalRows_portofolioPicRec = mysql_num_rows($portofolioPicRec); mysql_select_db($database_ecommerce_dbcon, $ecommerce_dbcon); $query_formidRec = "SELECT formId FROM `form`"; $formidRec = mysql_query($query_formidRec, $ecommerce_dbcon) or die(mysql_error()); $row_formidRec = mysql_fetch_assoc($formidRec); $totalRows_formidRec = mysql_num_rows($formidRec); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> Portfolio</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- Stylesheets --> <link rel="stylesheet" href="css/reset.css" /> <link rel="stylesheet" href="css/styles.css" /> <!-- Scripts --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <!--[if IE 6]> <script src="js/DD_belatedPNG_0.0.8a-min.js"></script> <script> /* EXAMPLE */ DD_belatedPNG.fix('.button'); /* string argument can be any CSS selector */ /* .png_bg example is unnecessary */ /* change it to what suits you! */ </script> <![endif]--> </head> <body class="portfolio"> <div id="wrapper" class="container_12 clearfix"> <!-- Navigation Menu --> <ul id="navigation" class="grid_8"> <li><a href="contact.php"><span class="meta">Get in touch</span><br />Contact Us</a></li> <li><a href="blog.php"><span class="meta">Latest news</span><br />Blog</a></li> <li><a href="portfolio.php" class="current"><span class="meta">Our latest work</span><br />Portfolio</a></li> <li><a href="about.php"><span class="meta">Who are we?</span><br />About</a></li> <li><a href="index.php"><span class="meta">Homepage</span><br />Home</a></li> </ul> <div class="hr grid_12 clearfix"> </div> <!-- Portfolio Items --> <!-- Section 1 --> <!-- Section 3 --> <div class="catagory_1 clearfix"> <!-- Row 1 --> <div class="grid_3 textright" > <span class="meta">Our Latest and Greatest Work</span> <h4 class="title ">Portfolio</h4> <div class="hr clearfix dotted"> </div> <p>Here you can see all the cars that exist in our database. You can navigate through all of them.</p> </div> <div class="grid_9"> <table > <tr> <?php $portofolioPicRec_endRow = 0; $portofolioPicRec_columns = 3; // number of columns $portofolioPicRec_hloopRow1 = 0; // first row flag do { if($portofolioPicRec_endRow == 0 && $portofolioPicRec_hloopRow1++ != 0) echo "<tr>"; ?> <td><a class="portfolio_item float alpha" href="portfolio_single.php?sid=<?php echo $row_formidRec['formId']; ?> ; ?>"> <span>Read More</span> <img class="" src="adminform_images/<?php echo $row_portofolioPicRec['picture']; ?>" alt=""/></a></td> <?php $portofolioPicRec_endRow++; if($portofolioPicRec_endRow >= $portofolioPicRec_columns) { ?> </tr> <?php $portofolioPicRec_endRow = 0; } } while ($row_portofolioPicRec = mysql_fetch_assoc($portofolioPicRec)); if($portofolioPicRec_endRow != 0) { while ($portofolioPicRec_endRow < $portofolioPicRec_columns) { echo("<td> </td>"); $portofolioPicRec_endRow++; } echo("</tr>"); }?> </table> </div> </div> <div class="hr grid_12 clearfix"> </div> </div><!--end wrapper--> </body> </html> <?php mysql_free_result($portofolioPicRec); mysql_free_result($formidRec); ?> and here is portfolio_single.php: <?php session_start(); $who = (int) $_GET['sid']; require_once('Connections/ecommerce_dbcon.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_ecommerce_dbcon, $ecommerce_dbcon); $query_portfolioSingleRec = "SELECT * FROM `form` where formid='$who'"; $portfolioSingleRec = mysql_query($query_portfolioSingleRec, $ecommerce_dbcon) or die(mysql_error()); $row_portfolioSingleRec = mysql_fetch_assoc($portfolioSingleRec); $totalRows_portfolioSingleRec = mysql_num_rows($portfolioSingleRec); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Aurelius | Portfolio >> Project Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- Stylesheets --> <link rel="stylesheet" href="css/reset.css" /> <link rel="stylesheet" href="css/styles.css" /> <!-- Scripts --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.roundabout-1.0.min.js"></script> <script type="text/javascript" src="js/jquery.easing.1.3.js"></script> <script type="text/javascript" src="js/jquery.roundabout-shapes-1.1.js"></script> <script type="text/javascript"> $(document).ready(function() { //Start up our Project Preview Carosuel $('ul#folio_scroller').roundabout({ easing: 'easeOutInCirc', shape: 'waterWheel', duration: 600 }); }); </script> <!--[if IE 6]> <script src="js/DD_belatedPNG_0.0.8a-min.js"></script> <script> /* EXAMPLE */ DD_belatedPNG.fix('.button'); /* string argument can be any CSS selector */ /* .png_bg example is unnecessary */ /* change it to what suits you! */ </script> <![endif]--> </head> <body> <div id="wrapper" class="container_12 clearfix"> <!-- Text Logo --> <h1 id="logo" class="grid_4">Aurelius</h1> <!-- Navigation Menu --> <ul id="navigation" class="grid_8"> <li><a href="contact.php"><span class="meta">Get in touch</span><br />Contact Us</a></li> <li><a href="blog.php"><span class="meta">Latest news</span><br />Blog</a></li> <li><a href="portfolio.php" class="current"><span class="meta">Our latest work</span><br />Portfolio</a></li> <li><a href="about.php"><span class="meta">Who are we?</span><br />About</a></li> <li><a href="index.php"><span class="meta">Homepage</span><br />Home</a></li> </ul> <div class="hr grid_12 clearfix"> </div> <!-- Catch Line and Link --> <h2 class="grid_12 caption clearfix">Our <span>portfolio</span>, home to our latest, and greatest work.</h2> <div class="hr grid_12 clearfix"> </div> <!-- Column 1 / Project Information --> <div class="grid_4"> <a class="meta" href="#">www.siteurlgoeshere.com</a> <h4 class="title">Project Name</h4> <div class="hr dotted clearfix"> </div> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <b>Mauris vel porta erat.</b> Quisque sit amet risus at odio pellentesque sollicitudin. Proin suscipit molestie facilisis. Aenean vel massa magna. Proin nec lacinia augue. Mauris venenatis libero nec odio viverra consequat. In hac habitasse platea dictumst.</p> <p>Cras vestibulum lorem et dui mollis sed posuere leo semper. Integer ac ultrices neque. Cras lacinia orci a augue tempor egestas. Sed cursus, sem ut vehicula vehicula, ipsum est mattis justo, at volutpat nibh arcu sit amet risus. Vestibulum tincidunt, eros ut commodo laoreet, arcu eros ultrices nibh, ac auctor est dui vel nibh.</p> <p class="clearfix"> <a href="portfolio.php" class="button float"><< Back to Portfolio</a> <a href="#" class="button float right">Visit Site</a> </p> </div> <!-- Column 2 / Image Carosuel --> <div id="folio_scroller_container" class="grid_8 cleafix"> <ul id="folio_scroller"> <li><span>Homepage</span><a href="#"><img alt="" src="adminform_images/<?php echo $row_portfolioSingleRec['picture']; ?>" /></a></li> </ul> </div> </div><!--end wrapper--> </body> </html> <?php mysql_free_result($portfolioSingleRec); ?> Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/ Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 when i hover to a picture on portfolio.php it shows this link ...portfoltio.php?sid=1; to all of them. Ehich means that whichever picture i click it shows only the picture of 1st row. :S:S any suggestion?? Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302806 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 A clue:... look at where you are getting and using this value $row_formidRec as opposed to where you are looping thru the returned db values Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302809 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 A clue:... look at where you are getting and using this value $row_formidRec as opposed to where you are looping thru the returned db values I think i didnt understood u clearly :S Row_formidRec is an id of the table that holds the pictures and it gets from db btw:thnx for reply Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302811 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 Being as this is homework (presumed form your other thread), look at this section of your code, and tell us what variable will contain the value you really want to use. do { if($portofolioPicRec_endRow == 0 && $portofolioPicRec_hloopRow1++ != 0) echo "<tr>"; ?> <td><a class="portfolio_item float alpha" href="portfolio_single.php?sid=<?php echo $row_formidRec['formId']; ?> ; ?>"> <span>Read More</span> <img class="" src="adminform_images/<?php echo $row_portofolioPicRec['picture']; ?>" alt=""/></a></td> <?php $portofolioPicRec_endRow++; if($portofolioPicRec_endRow >= $portofolioPicRec_columns) { ?> </tr> <?php $portofolioPicRec_endRow = 0; } } while ($row_portofolioPicRec = mysql_fetch_assoc($portofolioPicRec)); Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302813 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 Being as this is homework (presumed form your other thread), look at this section of your code, and tell us what variable will contain the value you really want to use. do { if($portofolioPicRec_endRow == 0 && $portofolioPicRec_hloopRow1++ != 0) echo "<tr>"; ?> <td><a class="portfolio_item float alpha" href="portfolio_single.php?sid=<?php echo $row_formidRec['formId']; ?> ; ?>"> <span>Read More</span> <img class="" src="adminform_images/<?php echo $row_portofolioPicRec['picture']; ?>" alt=""/></a></td> <?php $portofolioPicRec_endRow++; if($portofolioPicRec_endRow >= $portofolioPicRec_columns) { ?> </tr> <?php $portofolioPicRec_endRow = 0; } } while ($row_portofolioPicRec = mysql_fetch_assoc($portofolioPicRec)); this is for looping the pictures of portfolio.php. The variable that i want to get from here is $row_formidRec['formId']; which is assigned as 'sid'. Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302815 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 try changing.. sid=<?php echo $row_formidRec['formId']; ?> ; to sid=<?php echo $row_portofolioPicRec['formId']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302818 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 try changing.. sid=<?php echo $row_formidRec['formId']; ?> ; to sid=<?php echo $row_portofolioPicRec['formId']; ?> i changed but when i click now it shows no image. However when i hover to the picture i see it says undefined index; formid on the line that i made this change. Thnx dude for trying to help me. I really appriciate this Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302819 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 As a test, create this file and run it <?php require_once('Connections/ecommerce_dbcon.php'); mysql_select_db($database_ecommerce_dbcon, $ecommerce_dbcon); $query = "SELECT picture, formid FROM `form`"; $result = mysql_query($query, $ecommerce_dbcon) or die(mysql_error()); while($row = mysql_fetch_array($result)) { ?> <a href="portfolio_single.php?sid=<?php echo $row['formId']; ?>"><?php echo $row['picture']; ?>" alt=""/></a><br/> <?PHP } ?> Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302823 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 As a test, create this file and run it <?php require_once('Connections/ecommerce_dbcon.php'); mysql_select_db($database_ecommerce_dbcon, $ecommerce_dbcon); $query = "SELECT picture, formid FROM `form`"; $result = mysql_query($query, $ecommerce_dbcon) or die(mysql_error()); while($row = mysql_fetch_array($result) { ?> <a href="portfolio_single.php?sid=<?php echo $row['formId']; ?>"><?php echo $row['picture']; ?>" alt=""/></a><br/> <?PHP } ?> yeap it shows all the picture names that exist in db Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302824 Share on other sites More sharing options...
litebearer Posted December 31, 2011 Share Posted December 31, 2011 when you view the source, do you also see the proper id? Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302825 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 when you view the source, do you also see the proper id? no. it shws this: <a href="portfolio_single.php?sid=<br /> <b>Notice</b>: Undefined index: formId in <b>C:\xampp\htdocs\test.php</b> on line <b>8</b><br /> ">1 (14).jpg" alt=""/></a><br/> Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302826 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 1 (14).jpg alt=""/> This is how it shows the name of the pic in db. Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302827 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 ok dude in a href="portfolio_single.php?sid=<?php echo $row['formId']; the letter "I" was in uppercase so i changed it and now also in viewsource it shows ok. dhe sid=1 , sid=2... it shows in order Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302830 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 Ok dude i made it. if any further prob. ill open another post. Thank u for ur help. Quote Link to comment https://forums.phpfreaks.com/topic/254124-picture-galery-issue/#findComment-1302849 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.