Jump to content

Search the Community

Showing results for tags 'connection error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 3 results

  1. Hi all ! I have been using this snippet below to study exceptions: <?php mysqli_report(MYSQLI_REPORT_STRICT); try { $connection = new mysqli('localhos', 'root', '', 'test') ; } catch (Exception $e ) { echo "Server Error"; } ?> If, as in the snippet, I misspell the localhost, I am unable to override the php's own message. If, on the other hand I just misspell say the database name with the host spelt correctly, it overrides the php's default message. ( Default messages in both examples above being different). with the host name misspelt I receive the following warning: With the host name correct but a wrong database name I get the message defined in the snippet. Namely "Server Error". Kindly help resolve this. Thanks very much.
  2. i just created a new website for my local school i want to create a databse which will contain roll number ,marksof variosu subjects & name of students i created the database but now when i am trying to create a php script to enter students details i am having prouble in connection access denied for user 'abc'@'localhost' todatabse 'abc_db' what am i doing wrong ?? i think its because of user dont have proper privileges, how to give user privileges ?
  3. Hello ! I am new in php coding. So if you please help me in this regards I'll be very happy. I have received some error while connection to my mqsql database to a php file. At first I post my code.... "login.php" <?php $db_hostname = 'localhost' ; $db_database = 'PC' ; $db_username = 'admin' ; $db_password = 'maruf' ; ?> "func.php" <?php require_once('C:\xampp\htdocs\PC\login.php') ; function connect(){ $db_server = mysql_connect( $db_hostname , $db_username , $db_password ) ; if( !$db_server )die ( "Unable to connect to MySql : ".mysql_error()) ; mysql_select_db( $db_database ) or die("Unable to select database: ".mysql_error()) ; } function close(){ mysql_close() ; } function division(){ $mydata = mysql_query("SELECT * from division order by zeocode"); if( !$mydata ) echo "Database connection failed. ".mysql_error().'<br>' ; while( $record = mysql_fetch_array($mydata)){ echo '<option value ="' . $record['$name'] . '">' . $record['$name'] . '"</option>'; } } ?> "form.php" <?php require_once 'func.php'; connect() ; ?> <!DOCTYPE html> <html> <head> form </head> <body> <header> <h1 align='center'>Census</h1></header> <p> <select name ="division"> <?php query() ?> </select> <?php close() ?> </p> </body> </html> It shows me the following error . calling from the browser -> http://localhost/PC/form.php Notice: Undefined variable: db_hostname in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_username in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_password in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_database in C:\xampp\htdocs\Population_Census\func.php on line 12 Unable to select database: No database selected then I change form.php into this <?php //require_once('C:\xampp\htdocs\Population_Census\login.php') ; $db_hostname = 'localhost' ; $db_database = 'PC' ; $db_username = 'admin' ; $db_password = 'maruf' ; function connect(){ $db_server = mysql_connect( $db_hostname , $db_username , $db_password ) ; if( !$db_server )die ( "Unable to connect to MySql : ".mysql_error()) ; mysql_select_db( $db_database ) or die("Unable to select database: ".mysql_error()) ; } function close(){ mysql_close() ; } function division(){ $mydata = mysql_query("SELECT * from division order by zeocode"); if( !$mydata ) echo "Database connection failed. ".mysql_error().'<br>' ; while( $record = mysql_fetch_array($mydata)){ echo '<option value ="' . $record['$name'] . '">' . $record['$name'] . '"</option>'; } } ?> which show me exactly same problem.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.