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);
?>

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • You may quote other posts using [quote] tags.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • You can use BBCode tags in the text. URLs will automatically be converted to links.

More information about formatting options