제품 사이트에서 세션을 사용합니다. 내 문제는 어떻게 하나의 제품 데이터 시트 사이트의 URL을 보낼 수 있습니다.세션을 사용하는 URL을 어떻게 보낼 수 있습니까?
<?php session_start(); include "connection.php";
$sql = mysql_query("SELECT * FROM products WHERE img = '".$_COOKIE['image_src']."'");
while ($f = mysql_fetch_array($sql))
{
$_SESSION['fid'] = $f['id']; //product id
$_SESSION['fimg'] = $f['image']; //product image
$_SESSION['fname'] = $f['name']; //product name
$_SESSION['fdecription'] = $f['decription']; //product description
$_SESSION['fcategory'] = $f['category']; //product category
}
?>
을 내가 세션 (제품 정보를 정기적으로) 써 같은 사이트보다 : 나는 인덱스 사이트에 제품의 이미지를 클릭하면 제품 데이터 시트 사이트에서
, 나는 세션을 채우기예 :
<?php session_start(); print ($_SESSION[fname]);
echo "<img src='".$_SESSION['fimg']."' height='350' width='250'>";?>
그러나이 방법은 항상 마지막 클릭 된 제품 정보를 정기적으로는 세션에있을 것입니다. 동시에 두 개 이상의 제품 데이터 시트를 열 수 없습니다.
<?php
for($i=0; $i<count($_SESSION); $i++)
{
...
echo '<img src="'.$_SESSION[$i]["fimg"].'">';
...
}
?>
Multi-dimensional Arrays : 당신은, 단지 루프 해당 배열 이미지를 표시 할 페이지에 다음
<?php
session_start();
include "connection.php";
$sql = mysql_query("SELECT * FROM products WHERE img = '".$_COOKIE['image_src']."'");
# Create a counter variable
$counter = 0;
while ($f = mysql_fetch_array($sql))
{
$_SESSION[$counter]['fid'] = $f['id']; //product id
$_SESSION[$counter]['fimg'] = $f['image']; //product image
$_SESSION[$counter]['fname'] = $f['name']; //product name
$_SESSION[$counter]['fdecription'] = $f['decription']; //product description
$_SESSION[$counter]['fcategory'] = $f['category']; //product category
# Increment the counter
$counter++;
}
?>
:
죄송합니다. 이 "답변"을 제거하고이 코드를 원래 질문에 추가해야합니다. – Luke