i provide a telefonlist from another MSSQL-Database. i did this by folling user definited tag:
{telefonlist}
maybe it is helful for someone. i did not use the adodb.
the funktion convertUmlaute() does not work in the tag. if i use an iframe everythink works normal.
any solution to make it work as user definited tag?
Code: Select all
function convertUmlaute($text){
//DIE UMLAUTE WERDEN KONVERTIERT /////
$pattern1="/ä/";
$replace1="ä";
$text=preg_replace($pattern1,$replace1, $text);
$pattern2="/ö/";
$replace2="ö";
$text=preg_replace($pattern2,$replace2, $text);
$pattern3="/ü/";
$replace3="ü";
$text=preg_replace($pattern3,$replace3, $text);
$pattern1a="/Ä/";
$replace1a="Ä";
$text=preg_replace($pattern1a,$replace1a, $text);
$pattern2a="/Ö/";
$replace2a="Ö";
$text=preg_replace($pattern2a,$replace2a, $text);
$pattern3a="/Ü/";
$replace3a="Ü";
$text=preg_replace($pattern3a,$replace3a, $text);
$pattern4="/ß/";
$replace4="ß";
$text=preg_replace($pattern4,$replace4, $text);
return $text;
}
$myServer = "10.11.30.3";
$myUser = "sa";
$myPass = "sa";
$myDB = "Verwaltung";
$s = @mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
$d = @mssql_select_db($myDB, $s)
or die("Couldn't open database $myDB");
$query = "SELECT N_Name, N_Vorname, F_Txt, An_Hausruf, R_txt, G_txt, B_Txt, B_Langtext, D_Txt, An_Fernruf ";
$query .= "FROM AI_A_Orgplan ";
$query .= "WHERE B_Txt LIKE 'K%' ";
$query .= "ORDER BY D_Sort, D_Txt, B_Sort, B_Txt, F_Sort, F_Txt, N_Name, N_Vorname";
$result = mssql_query($query);
$numRows = mssql_num_rows($result);
echo "<table>";
echo "<tr>";
$strName=" ";
while($row = mssql_fetch_array($result))
{
if ($strName==$row["B_Txt"])
{
echo "<tr>";
echo "<td>" . convertUmlaute($row["F_Txt"]) . "</td>";
echo "<td>" . convertUmlaute($row["N_Name"]) .', '. $row["N_Vorname"] . "</td>";
echo "<td>" . convertUmlaute($row["An_Hausruf"]) . "</td>";
echo "<td>" . convertUmlaute($row["R_txt"]) . "</td>";
echo "<td>" . convertUmlaute($row["An_Fernruf"]) . "</td>";
echo "</tr>";
}
else
{
echo "<tr>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
$strName=convertUmlaute($row["B_Txt"]);
echo "<td><h3>" . convertUmlaute($row["B_Txt"]) . "</h3></td>";
echo "<td><h3>" . convertUmlaute($row["B_Langtext"]) . "</h3></td>";
echo "<td></td>";
echo "<td></td>";
echo "<td></td>";
echo "</tr>";
echo "<tr>";
echo "<td><u>Funktion</u></td>";
echo "<td><u>Name</u></td>";
echo "<td><u>Hausruf</u></td>";
echo "<td><u>Raum</u></td>";
echo "<td><u>Fernruf</u></td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . convertUmlaute($row["F_Txt"]) . "</td>";
echo "<td>" . convertUmlaute($row["N_Name"]) .', '. $row["N_Vorname"] . "</td>";
echo "<td>" . convertUmlaute($row["An_Hausruf"]) . "</td>";
echo "<td>" . convertUmlaute($row["R_txt"]) . "</td>";
echo "<td>" . convertUmlaute($row["An_Fernruf"]) . "</td>";
echo "</tr>";
}
}
echo "</table>";