You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Hello,

How can i use a PHP script  in the Custom Html?

Can i add something to the Joget(2.0.3)?

Is it possible?

I would like to connect to database and make a report like this:(but not working)

<html><head><title>MySQL Table Viewer</title></head><body>
<?php
$db_host = 'localhost';
$db_user = 'joget';
$db_pwd = 'pass';
$table = "formdata_Jogosultsagok_BF";
$database = 'wflowdb';

if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");

if (!mysql_select_db($database))
    die("Can't select database");

$result = mysql_query("SELECT c_Szolg_Id, c_SzKor_Id,c_SzKor_Nev,c_Ervenyes FROM formdata_Jogosultsagok_BF WHERE c_user_name='buranym'  and c_SzKor_Id is not null and c_Szolg_Id = 'SAP' order by c_SzKor_Id");
if (!$result) {
    die("Query to show fields from table failed");
}

$fields_num = mysql_num_fields($result);

echo "<h1>Table: {$table}</h1>";
echo "<table border='1'><tr>";
for($i=0; $i<$fields_num; $i++)
{
    $field = mysql_fetch_field($result);
    echo "<td>{$field->name}</td>";
}
echo "</tr>\n";
while($row = mysql_fetch_row($result))
{
    echo "<tr>";

    // $row is array... foreach( .. ) puts every element
    // of $row to $cell variable
    foreach($row as $cell)
        echo "<td>$cell</td>";

    echo "</tr>\n";
}
mysql_free_result($result);
?>
</body></html>

  • No labels