Jump to content

Php $page problem


jason360

Recommended Posts

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');

Link to comment
https://forums.phpfreaks.com/topic/265123-php-page-problem/
Share on other sites

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! :)

Link to comment
https://forums.phpfreaks.com/topic/265123-php-page-problem/#findComment-1358654
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.