Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4098264
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:16:46+00:00 2026-05-20T20:16:46+00:00

<?php $mysql_host=’mysql1.000webhost.com’; $mysql_dbname=’a8130617_skola’; $mysql_username=’something’; $mysql_password=’something’; class mysql { try{ public $db = new PDO(mysql:host=$mysql_host;dbname=$mysql_dbname,

  • 0
<?php
$mysql_host='mysql1.000webhost.com';
$mysql_dbname='a8130617_skola';
$mysql_username='something';
$mysql_password='something';

class mysql {
    try{
    public $db = new PDO("mysql:host=$mysql_host;dbname=$mysql_dbname",
            $mysql_username, $mysql_password);
    }
    catch(PDOException $e){
        echo $e->getMessage();
    }
} //ERROR EXCLAMATION MARK HERE???
?>

why does netbeans 6.9.1 consider this to be false syntax?
many thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:16:46+00:00Added an answer on May 20, 2026 at 8:16 pm
    try{
    public $db = new PDO("mysql:host=$mysql_host;dbname=$mysql_dbname",
            $mysql_username, $mysql_password);
    }
    catch(PDOException $e){
        echo $e->getMessage();
    }
    

    Try catch blocks need to be inside a method. But going with that, not sure why you are wrapping this in a class? Your class is a wrapper for an already defined class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class.mysql.php has 2 classes: MySQL and MySQLResult class.mysql.php: <?php /** * MySQL Database Connection
I'm using a slight variation on the PHP PDO Wrapper Class found here: http://www.imavex.com/php-pdo-wrapper-class/
This is the code I'm using: <?php // Set the MySQL Configuration $db_host =
I have a php host, and a mysql database. from that i wish to
PHP/MySQL (CodeIgniter) I would like to add new interest_keywords in the exist database value.
Are PHP/mysql prepared statements possible when mysqli and PDO are not available? Are there
Language: PHP / MySQL I am going out of my mind, I really have
Using PHP / MySQL all encoded up as UTF, we have recently had to
I am turning my PHP/MySQL/jQuery Mobile/Javascript webapp into a app thanks to Phonegap. I
a bit of a PHP / MySQL newbie here... I've been building a PHP-based

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.