A
A
andrewer2015-12-02 21:51:18
PHP
andrewer, 2015-12-02 21:51:18

Product page for an online store, how to create?

There is a page - the catalog of goods.

<?
              if (!$_COOKIE[password]){
                    echo "Время сессии истекло";       //проверяем куки (каталог только для админов)
}

else{




$linkt = mysqli_connect('localhost','u529466638_andre','123456','u529466638_data');   //подключение к БД

$rest = mysqli_query($linkt, "SELECT * FROM data ORDER BY id");  

$rowt = mysqli_fetch_assoc($rest);   //массив-запрос





do {           //цикл
                echo "<p>Имя: $rowt[name]</p> <p>Категория: $rowt[Category]</p> <p>Описание: $rowt[about]</p><br>";   //печатанье "блока"
}
                 while($rowt = mysqli_fetch_assoc($rest));  //проверка условия


}
?>

<a href="/formlog.php">&#1053;&#1072; &#1075;&#1083;&#1072;&#1074;&#1085;&#1091;&#1102;</a>  //ссылка на другую страницу

That is, it displays the product name, category, and description. I really do not want to create a separate page for each product, how can I make it so that from each "block" I can go to the "universal page" of the product. That is, with each iteration of the loop, a variable with a value of $var=$rowt[id] is created and passed to the "universal page". How to do this, please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dim Boy, 2015-12-02
@twix007

smarty - create a tpl page template file and pass variables there. If so understood.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question