• HOME
  • ABOUT
  • OUR SERVICES

      DEVELOPMENT

      • Web Design & Development
      • App Development
      • E-commerce Solutions

      WEB SERVICES

      • Website Maintenance
      • Content Management
      • Search Engine Optimisation

      DESIGN

      • Graphic Design
      • Logo Branding
      • Brochures & Stationery

      CUSTOMER SUPPORT

      • Email Marketing
      • Consultancy Services
      • Social Media Marketing
  • OUR WORK
  • BLOG
  • CLIENTS
  • CONTACT
  • LOGIN
    • Login
    • Forgot Password?
  • More
  • Home
  • Store
    • Browse All
    • Hosting
    • Website Builder
    • Just Email
    • E-Marketing
    • SEO
    • Site Builder
    • Register a New Domain
    • Transfer Domains to Us
  • Announcements
  • Knowledgebase
  • Network Status
  • Affiliates
  • Contact Us
  • More
  • Account
    • Login
    • Forgot Password?
  1. Portal Home
  2. Knowledgebase
  3. Control Panel
  4. How do I connect to my MySQL database?

  Categories

21
Control Panel
16
Domains
73
Email
21
FTP
9
Glossary
160
Web Hosting

  Categories

  Support

  My Support Tickets   Announcements   Knowledgebase   Downloads   Network Status   Open Ticket

How do I connect to my MySQL database? Print

  • 0


A simple php script to open a connection to a database

$dbhost = 'localhost';
$dbuser = 'db username';
$dbpass = 'db password';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'db name';
mysql_select_db($dbname);
?>

Save this as .php and then whenever you want to access the database, just add

include '.php'

to the top of a php script and the database can be queried using standard sql commands.



Was this answer helpful?

Related Articles

I'm trying to upload a large file onto my webspace, and the file manager inside the Online Control Panel Control Panel won't let me. Why? This is due to the nature of the web based FTP used, and your browser/ISP connection timing out... On accessing the control panel, the error "for security reasons your session has expired" is displayed? There are a few reasons why the session expiry error is displayed when accessing the Online... File Manager session expiry errors In order to keep your files secure against various threats, File Manager requires that your... Why am I getting a 550 error when trying to create folders in file manager? This suggests a permissions problem related to the creation of the account. You should contact... I've uploaded files to File manager but cannot see them, they were recently visible. What's happened? File manager has a 5mb memory limit which restricts the number of files that can be displayed if...
« Back

  Support

  My Support Tickets   Announcements   Knowledgebase   Downloads   Network Status   Open Ticket
Do you like our work? GET IN TOUCH +353 (0)21 432 8060
Facebook Logo Twitter Logo Youtube Logo Google Plus Logo Linked In Logo

Loading...
Loading...

Generate Password

Please enter a number between 8 and 64 for the password length