Anton: Ich raffe es einfach nicht.

Beitrag lesen

Ich verstehe es einfach nicht:

Hier sind meine beiden Tabellen:

CREATE TABLE contacts (
  id int(11) NOT NULL auto_increment,
  public char(1) default NULL,
  gender char(1) NOT NULL default '',
  title varchar(5) NOT NULL default '',
  name\_f varchar(10) default NULL,
  name\_l varchar(20) NOT NULL default '0',
  phone\_country tinyint(4) NOT NULL default '0',
  phone\_city varchar(25) NOT NULL default '',
  phone\_no varchar(10) NOT NULL default '',
  phone\_ext varchar(5) NOT NULL default '',
  fax\_city varchar(25) NOT NULL default '',
  fax\_no varchar(10) NOT NULL default '',
  fax\_ext varchar(10) NOT NULL default '',
  bio text NOT NULL,
  pic varchar(25) NOT NULL default '',
  PRIMARY KEY  (id),
  UNIQUE KEY name (name\_f,name\_l),
  KEY id (id)
) TYPE=MyISAM AUTO_INCREMENT=29 ;

CREATE TABLE contacts\_functions (
  id int(11) NOT NULL default '0',
  id\_company int(10) unsigned default NULL,
  public char(1) default NULL,
  function varchar(60) NOT NULL default '',
  dienst char(2) NOT NULL default '',
  email varchar(30) NOT NULL default '',
  KEY id (id)
) TYPE=MyISAM;

CREATE TABLE contacts\_pictures (
  id\_contact int(11) NOT NULL default '0',
  picture varchar(25) NOT NULL default '0',
  width smallint(6) NOT NULL default '0',
  height smallint(6) NOT NULL default '0',
  ext char(3) NOT NULL default ''
) TYPE=MyISAM;

Hier ist die SQL Anweisung:

$sql = "
SELECT c.id, c.pic, c.phone_country,
       c.phone_city, c.phone_no, c.phone_ext, c.fax_city, c.fax_no, c.fax_ext, cf.function,
       CONCAT(c.name_l, ', ', c.name_f) AS name,
       LOWER(CONCAT(c.name_f, '_', c.name_l)) AS folder
       FROM contacts c, lnk_company_contact lcc, contacts_functions cf
       WHERE (c.id = lcc.id_contact)
       AND   (c.public = 'j')
       AND   (cf.id = c.id)
       AND   (lcc.id_company = '350')
       ORDER BY c.name_l";

$page->assign('employees', $denclass->returnData($sql, $convert));

Hier ist die Ausgabe mit der Smarty Schablone:
{section name=i loop=$employees}
<div>
<img class="left" src="../images/person/{$employees[i].folder}/{$employees[i].folder}_round.gif" alt="{$employees[i].name}" />
<table>
<tr><td><a href="contact.php?id={$employees[i].id}">{$employees[i].name}</a></td></tr>
<tr><td><b>Funktion:</b> {$employees[i].function}</td></tr>   <tr><td><b>Tel:</b> +{$employees[i].phone_country} {$employees[i].phone_city} {$employees[i].phone_no} {$employees[i].phone_ext}</td></tr>      <tr><td><b>Fax:</b> +{$employees[i].phone_country} {$employees[i].fax_city} {$employees[i].fax_no} {$employees[i].fax_ext}</td></tr>      </table>
<br style="clear: left;"/><br />      </div>
{/section}