Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
I need values from DB table with links in smarty

 
Post new topic   Reply to topic    Smarty Forum Index -> Plugins
View previous topic :: View next topic  
Author Message
alphalycos2
Smarty n00b


Joined: 28 Dec 2012
Posts: 2

PostPosted: Fri Jan 04, 2013 7:33 am    Post subject: I need values from DB table with links in smarty Reply with quote

Here is my code in the ordinary php anyone to help me change it to smarty

*************************************************************
HERE BELOW
*************************************************************

<?php
mysql_connect('localhost','root','');
mysql_select_db('alsuite');

$org=mysql_query("select * from al_organs order by name asc"); //******* SELECT ALL ORGANISATIONS

$user=''; //******* LOGGED IN USER
$user_org=''; //******* LOGGED IN USER

$org_no=mysql_num_rows(mysql_query("select * from al_organs_assigned where uid='".$user."'"));
$unit_no=mysql_num_rows(mysql_query("select * from al_units_assigned where uid='".$user."'"));


?>
<?php
while($org_row=mysql_fetch_array($org))
{
?>
<?php
$og_uz=mysql_query("select * from al_organs_assigned where uid='".$user."' and organ='".$org_row['id']."'"); //******* SELECT ALL ORGANISATIONS
if(mysql_num_rows($og_uz)>0)
{
?>
<?php // echo $org_row['id'] ?>
<?php echo "<strong>".$org_row['name']."</strong><br>"; ?>
<ul>
<?php
$a=mysql_query("select * from al_units where organ='".$org_row['id']."'");
while($b=mysql_fetch_array($a))
{
$c=mysql_query("select * from al_units_assigned where uid='".$user."' and unit='".$b['id']."'"); //******* SELECT ALL ORGANISATIONS
if(mysql_num_rows($c)>0)
{
echo '<li><a href="./12520">'.$b['name'].'</a></li>';
}
}

?>
</ul>
<?php
}

?>

<?php
}
?>
Back to top
View user's profile Send private message Send e-mail
TomTo
Smarty Rookie


Joined: 30 May 2009
Posts: 18

PostPosted: Fri Jan 04, 2013 12:19 pm    Post subject: Reply with quote

please, give us detailed SQL Tables, otherwise I cannot eliminate the code chaos...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Plugins 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