MozdevDatabaseAccess

Database requests

Projects may request the setup of a MySQL database for use from their project. Mozdev will monitor database usage and notify you if your usage becomes problematic. To request database for your project, file a bug and describe your intended usage.

Setting up database access

Mozdev will create a file on the web server containing your authentication information. To use your database you need to include this file and connect to mysql. Some examples are included below.

  • insde .html pages:

<?php
require PROJECT_SITE_DATA.'/dbconf.php';
$pr_conn = mysql_connect('localhost', $GLOBALS'mozdevdb''username',
$GLOBALS'mozdevdb''password');
mysql_select_db($GLOBALS'mozdevdb''database', $pr_conn);
?>

  • .php pages require an additional require before the include:

<?php
require '/sandbox/php/include/globals.h';
include_once PROJECT_SITE_DATA.'/dbconf.php';
$pr_conn = mysql_connect('localhost', $GLOBALS'mozdevdb''username',
$GLOBALS'mozdevdb''password');
mysql_select_db($GLOBALS'mozdevdb''database', $pr_conn);
?>