Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

getting items row in php smarty?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
crf121359
Smarty n00b


Joined: 29 Apr 2014
Posts: 3

PostPosted: Tue Apr 29, 2014 3:51 pm    Post subject: getting items row in php smarty? Reply with quote

Hello,

Just started using smarty and I thought everything was going fine in terms of learning etc until now.

I am trying to find a way to get the item's row ($product_name, $details, $price) etc in smarty with no avail.

The only thing that I could get is the image of the product.

for example, when I click on the product/item in the index.php, I get redirected to the details.php and I see the image of the item that I clicked on but I cannot see the rest of its details i.e. product_name, price, details etc etc.

here is my product.php code:

Code:
<?php

// These are the smarty files
require 'libs/Smarty.class.php';

$smarty = new Smarty;

$smarty->compile_check = true;
$smarty->debugging = false;
$smarty->use_sub_dirs = false;
$smarty->caching = false;

// This SQL statement will get the 5 most recently added new items from the database

$storeShop = isSubdomain();
if (isset($_GET['id'])) {
    // Connect to the MySQL database 
    include "config/connect.php";
    // 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
    $sql = "SELECT product_name 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) {
             while ($line = mysql_fetch_assoc($result))
{
        while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){
             $value[] = $line;

}
}

// Assign this array to smarty...
$smarty->assign('storeShop', $value);



// Assign this array to smarty...
$smarty->assign('$storeShop', $value);


         }
    }

// Display the news page through the news template
$smarty->display('product.tpl.html');

?>




and this is how I "try" to get the row's in my smarty page:


Code:
    <div class="center_content">
    {if isset($smarty.get.id)}

      {$row.product_name}

<img src="images/{$smarty.get.id}Image1.jpg" alt="" border="0" width="120" height="100" />
{/if}

</div>





could someone please let me know what i am doing wrong?

Thanks in advance
Back to top
View user's profile Send private message
crf121359
Smarty n00b


Joined: 29 Apr 2014
Posts: 3

PostPosted: Tue Apr 29, 2014 7:25 pm    Post subject: Reply with quote

NO ONE? REALLY?!?!?!?
Back to top
View user's profile Send private message
crf121359
Smarty n00b


Joined: 29 Apr 2014
Posts: 3

PostPosted: Tue Apr 29, 2014 7:33 pm    Post subject: Reply with quote

never mind. wont be using this shitty smarty bollox anyway. I started using another php template engine which is alot easier and it actually has documentation for "users" and not just for the people who developed the bloody thing. well, I'm yet another smarty hater. get lost.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP