haris244808 Posted December 30, 2011 Share Posted December 30, 2011 Hi there. I have a page(portfolio.php) that shows all the pictures from my db. Now what i want is: when i click on the picture to send me to a page(portfolio_single.php) where other datas are shown but those datas that are related to that picture. ex: when i click first picture it will open (portfolio_single.php) showing the infos of that picture, then when i click to the secon picture it will open same page with different datas (retreiving them from db). Anyone have any idea how to do that? here is my 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); ?> <!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"> <!-- Admin Login --> <h1 id="login" class="grid_4"> <form id='login' action="checkAdminLogin.php" method='POST' accept-charset='UTF-8'> <fieldset > <legend class="meta">Admin Login</legend> <input type='hidden' name='submitted' id='submitted' value='1'/> <table> <tr><th> <label for='username'>Name:</label> </th> <td><input type='text' name='username' id='username' maxlength="50" /> </td></tr> <tr><th> <label for='password'>Password:</label></th> <td><input type='password' name='password' id='password' maxlength="50" /> </td> <th><input type='submit' name='Submit' value='Login' /> </th></tr> </table> </fieldset> </form> </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> <!-- 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"> <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> <!-- Footer --> <p class="grid_12 footer clearfix"> <span class="float"><b> EpokaUniversity || All Rights Reserved © Copyright</b> || HarisKrasniqi, DiamantNeziri, HarisMemeti, KelmendTairi.</span> <a class="float right button" href="#">top</a> </p> </div><!--end wrapper--> </body> </html> <?php mysql_free_result($portofolioPicRec); ?> portofolio_single.php: suppose it is a table that contains the: name: (it will echo out the name of the picture depending on which picture u click) date: path: etc of the photo Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/ Share on other sites More sharing options...
litebearer Posted December 30, 2011 Share Posted December 30, 2011 similar to this? http://www.nstoia.com/sat/disp_pag/four.php Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302649 Share on other sites More sharing options...
haris244808 Posted December 30, 2011 Author Share Posted December 30, 2011 similar to this? http://www.nstoia.com/sat/disp_pag/four.php yes man. Similar to that Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302651 Share on other sites More sharing options...
litebearer Posted December 30, 2011 Share Posted December 30, 2011 all the code is there for you to see/download Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302653 Share on other sites More sharing options...
haris244808 Posted December 30, 2011 Author Share Posted December 30, 2011 all the code is there for you to see/download Ok ill try to modify mine and ill let u know if so, thnx dude Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302655 Share on other sites More sharing options...
haris244808 Posted December 30, 2011 Author Share Posted December 30, 2011 ok im trying however i cannot get what i want it shwos me alll the database: here i give u the code of html where the datas will be shown. Can u help me to modify this page? here is the samplepage(portfolio_single.php): <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>Type: here comes the type from db field</p> <p>Year: the year from db</p> <p>Price:</p> <p>Date:</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="here comes the picture from database" /></a></li> </ul> </div> Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302660 Share on other sites More sharing options...
haris244808 Posted December 30, 2011 Author Share Posted December 30, 2011 cmon anyone help. i have this project for school :S im tryiing to modify but i get all the pictures from db. PLs anone help in this Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302682 Share on other sites More sharing options...
haris244808 Posted December 31, 2011 Author Share Posted December 31, 2011 ok here is the page that i modified: but it doesnt show the datas: <?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_prtfolioSingleRec = "SELECT * FROM `form` where formid='$who'"; $prtfolioSingleRec = mysql_query($query_prtfolioSingleRec, $ecommerce_dbcon) or die(mysql_error()); $row_prtfolioSingleRec = mysql_fetch_assoc($prtfolioSingleRec); $totalRows_prtfolioSingleRec = mysql_num_rows($prtfolioSingleRec); if($totalRows_prtfolioSingleRec > 0) { ?> <img src="sharedfiles/eyesx1.jpg" width="376" height="142" alt=""><p> It appears we are unable to find that picture!<br> <?PHP exit(); } /* Build the profile data variables */ $price = $row_prtfolioSingleRec['price']; $type = nl2br($row_prtfolioSingleRec['type']); ?> <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <script language="JavaScript"> window.onload = maxWindow; function maxWindow() { window.moveTo(0,0); if (document.all) { top.window.resizeTo(screen.availWidth,screen.availHeight); } else if (document.layers||document.getElementById) { if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth) { top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } } </script> <title></title> <meta name="GENERATOR" content="Arachnophilia 4.0"> <meta name="FORMATTER" content="Arachnophilia 4.0"> </head> <body bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000"> <div style="position: absolute; top: 80px; left: 40px; font-size:14pt; padding:10px;"> <font color=#000000><b><i><?PHP echo $price; ?></i></b></font><p> <div style="width: 300px;"> <fieldset style="border-width: 1px; border-style: solid; bordercolor: grey; font-size:12pt; padding:10px"> <legend><font size="-1"><i><font color=#808080><b>About this photo...</b></font></i></font></legend> <?PHP echo $type; ?><br><br> </div> <a href="#" onClick="opener=self;window.close();"><b><i><u><font color=#ff000000><font size="-1">click here to close this window</font></font></u></i></b></a> </div> <div style="position: absolute; top: 80px; left: 450px;"> <IMG src="adminform_images/<?php echo $row_prtfolioSingleRec['picture']; ?>" border="0"> </div> </body> </html> <?php mysql_free_result($prtfolioSingleRec); ?> and here is the code for directing to this page when clicked: href="now2.php?sid=<?PHP echo $row_prtfolioSingleRec['formid']; ?>" Link to comment https://forums.phpfreaks.com/topic/254093-multiple-data-to-a-same-page/#findComment-1302800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.