jason360 Posted July 2, 2012 Share Posted July 2, 2012 Hey guys, This is probably simple but I can't figure out what I am doing wrong. I am trying to get this $page to redirect to a dynamic page using the id. This code I am using for $page ='../shop/product.php?pid='.$id.''; is coming up blank for the id. Any help is appreciated. Thanks JK define('INCLUDE_CHECK',true); require('../config.inc.php'); require('../functions.php'); // initialization $result_array = array(); $counter = 0; $pid = ($_GET['pid']); // Full Size View of Photo if( $pid ) { $result = mysql_query( "SELECT * FROM products WHERE id='".addslashes($pid)."'" ); list($id, $name, $description, $snippet, $link, $price, $shipping, $quantity, $anchor) = mysql_fetch_array( $result ); $nr = mysql_num_rows( $result ); mysql_free_result( $result ); } // cart php $page ='../shop/product.php?pid='.$id.''; require('../shop/cart.php'); Quote Link to comment https://forums.phpfreaks.com/topic/265123-php-page-problem/ Share on other sites More sharing options...
n1concepts Posted July 2, 2012 Share Posted July 2, 2012 A couple of immediate things i would do is echo your $pid variable to ensure you're even getting the id (variable) you seeking from $_GET. Then I would echo the SQL statement and $results to ensure it's valid structure - no syntax issue. Lastly, double check your path - I see you have '../' so that's taking out one step back from current file location. Could be any one of those issues preventing the correct page from displaying - but this is a high level answer as well without seeing the actual scripts together. Hope this helps! Quote Link to comment https://forums.phpfreaks.com/topic/265123-php-page-problem/#findComment-1358654 Share on other sites More sharing options...
jason360 Posted July 2, 2012 Author Share Posted July 2, 2012 Thanks for the suggestion N1. I found my issue. My cart.php code was losing the get id in redirect. Problem solved. Quote Link to comment https://forums.phpfreaks.com/topic/265123-php-page-problem/#findComment-1358665 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.