|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
alphalycos2 Smarty n00b
Joined: 28 Dec 2012 Posts: 2
|
Posted: Fri Jan 04, 2013 7:33 am Post subject: I need values from DB table with links in smarty |
|
|
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 |
|
TomTo Smarty Rookie
Joined: 30 May 2009 Posts: 18
|
Posted: Fri Jan 04, 2013 12:19 pm Post subject: |
|
|
please, give us detailed SQL Tables, otherwise I cannot eliminate the code chaos... |
|
Back to top |
|
|
|
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
|