davithedork Posted May 25, 2007 Share Posted May 25, 2007 hi, i was wondering if this is a session that i need to accomplish this task: please give me some tips on how i can do this. thanks. =] Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 25, 2007 Share Posted May 25, 2007 No...that is not a session. www.php.net/session Looks like you are trying to take on a project beyond your knowledge of PHP. So I would suggest doing more research on PHP and build yourself up to the point to being able to create a program like the one you describe above, or post in the freelancing forum and pay for someone to create it for you. Quote Link to comment Share on other sites More sharing options...
448191 Posted May 25, 2007 Share Posted May 25, 2007 That is not a session either. A session is a timespan. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted May 26, 2007 Share Posted May 26, 2007 Now I'm just confused.... 0_o haha Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted May 26, 2007 Share Posted May 26, 2007 A session is a timespan. You do know this is a php forum right? He's not referring to a therapy session or anything. Sessions keep track of data on a per user basis on the server side. They are only maintained for a certain period of time, however, the "session" itself is the data, not a period of time. Quote Link to comment Share on other sites More sharing options...
per1os Posted May 26, 2007 Share Posted May 26, 2007 You will probably need to use post/get to achieve that page. That or use mod_rewrite to make the url friendlier. Unless you used ajax to when clicked on the link it goes to a php page and sets a session variable and than it redirects you to the view.php page where you view it. It is always fun describing how to do a script =) Quote Link to comment Share on other sites More sharing options...
448191 Posted May 26, 2007 Share Posted May 26, 2007 You do know this is a php forum right? Is that intended to be funny? Sessions keep track of data on a per user basis on the server side. They are only maintained for a certain period of time, however, the "session" itself is the data, not a period of time. I've had this discussion many times, and it has learned me that php developers (or maybe even web developers in general, but I wouldn't know that) use the term 'session' to loosely. A session is a period of time. More specifically, it is a period of time in which a state between two parties (or more) is maintained. In web dev, this refers to the client and the server. Data used to maintain state within this period of time can be referred to as 'session data'. Php has it's build-in 'session management system' (the interface of which consists of the $_SESSION superglobal and the session handling functions). Neither of these are analogous to the term 'session'. Misuse of the term 'session' leads to some people misunderstanding, or even thinking that sessions are some magic entity within a php application. When in fact php's session management system is a very simple one, which can easily be replaced by a completely custom session management system. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted May 26, 2007 Share Posted May 26, 2007 hi, i was wondering if this is a session that i need to accomplish this task: please give me some tips on how i can do this. thanks. =] No its not anything to do with sessions. What you will want to do is use a database which holds image id and all info about that image. In order for PHP to grab all the info for that particular image you want to use some form of identifier. Such as the image id. So your links will be like this: showImage.php?pid=xxx - xxx being the id for that image. In order to get the pid variable in showImage.php you will want to use the $_GET superglobal array. It works the same as $_POST, $_SESSION etc. So to get the pid url variable you will use the following variable: $_GET['pid'] So how do you get PHP to grab all the relevant info for the clicked image. A very simple way would be like the following: <?php // connect to MySQL here // get the vital image identifier (pid) // we also do a bit of validation too. if(isset($_GET['pid']) && is_numeric($_GET['pid'])) { $image_id = $_GET['pid']; } else { die('Invalid image identifier passed'); } // build the SQL query $sql = "SELECT * FROM image_info WHERE img_id = '$image_id' LIMIT 1"; // process the SQL query $qry = mysql_query($sql); // check that the query return 1 result. This is just check that atleast 1 match was found // if no matches where found then pid that was passed was invalid. if(mysql_num_rows($qry) == 1) { // 1 result returned, meaning a match was found // get the return result from the result set ($qry) $row = mysql_fetch_assoc($qry); // here you place the template that shows the info about the image } else { // no matches where found die('No matches found'); } ?> That will be the basics of how to do it. If you do understand the code provided then please say. 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.