I have been trying for hours to assign mysql rows in smarty php
with no luck.
I have this in product.php file:
require 'libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->use_sub_dirs = false;
$smarty->caching = false;
if (isset($_GET['id'])) {
// Connect to the MySQL database
include "config/connect.php";
$id = preg_replace('#[^0-9]#i', '', $_GET['id']);
// Use this var to check to see if this ID exists, if yes then get the product
// details, if no then exit this script and give message why
$storeShop = isSubdomain();
$sql = "SELECT * FROM $storeShop WHERE id='$id' LIMIT 1";
$query = mysqli_query($db_conx, $sql);
$productCount = mysqli_num_rows($query); // count the output amount
if ($productCount > 0) {
// get all the product details
while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
$value[] = $line;
$id = $row["id"];
$product_name = $row["product_name"];
$price = $row["price"];
$shipping = $row["shipping"];
$details = $row["details"];
$category = $row["category"];
$manu = $row["manu"];
}
}
}
$smarty->display('product.tpl');
and this is what I have in product.tpl file:
{if isset($smarty.get.id)}
{$smarty.get.id.product_name)
<img src="images/{$smarty.get.id}Image1.jpg" alt="" border="0" width="120" height="100" />
{/if}
the only thing that I could get to display is the image but I cannot get rows
. for example: $product_name
.
Could someone please help me with this as it literally is giving me a massive headache.
Thank you in advance,