Hi,

You should not connect to the database directly because not everybody
uses MySQL with ownCloud.

Please use \OC::$server->getDatabaseConnection() which gives you an
abstract database connection from which you can execute your SQL statements.

See
https://github.com/owncloud/core/blob/v8.2.0/lib/private/allconfig.php#L211
for an example

Cheers,

Vincent

On 18.10.2015 19:11, andy wrote:
> Hi all,
>
>  
>
> I am about to integrate a more complex open source JS app into owncloud.
> Main steps are done so far but I am stuck on receiving data from the
> database. The script calls the data via .load("data.php"). Including just
> data.php in the part.content.php is working but leaving the
> .load("data.php") in the script results in nothing. The script itself ist
> running without any problems outside of owncloud. 
>
>  
>
> The data.php file looks like
>
>  
>
> <?php
>
> $oc_host = OC::$server->getSystemConfig()->getValue('dbhost', false);
>
> $oc_user = OC::$server->getSystemConfig()->getValue('dbuser', false);
>
> $oc_password = OC::$server->getSystemConfig()->getValue('dbpassword',
> false);
>
> $oc_name = OC::$server->getSystemConfig()->getValue('dbname', false);
>
> $link_table = OC::$server->getSystemConfig()->getValue('dbtableprefix',
> false).'owngantt_links';
>
> $task_table = OC::$server->getSystemConfig()->getValue('dbtableprefix',
> false).'owngantt_tasks';
>
>  
>
> $res=mysql_connect($oc_host,$oc_user,$oc_password);
>
> mysql_select_db($oc_name);
>
>  
>
> include ('apps/owngantt/codebase/connector/gantt_connector.php');
>
>  
>
> $gantt = new JSONGanttConnector($res);
>
>  
>
> $gantt->render_links($link_table,"id","source,target,type");
>
> $gantt->render_table(
>
>    $task_table,
>
>    "id",
>
>    "start_date,duration,text,progress,sortorder,parent"
>
> );
>
>  
>
>  
>
> ?>
>
>  
>
> Has anybody any ideas what should I do to get the things running?
>
>  
>
> Thx!
>
>  
>
> Andy
>
>
>
>
> _______________________________________________
> Devel mailing list
> [email protected]
> http://mailman.owncloud.org/mailman/listinfo/devel

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Devel mailing list
[email protected]
http://mailman.owncloud.org/mailman/listinfo/devel

Reply via email to