Skip to content
Fix Code Error

Fatal error: Uncaught Error: Call to undefined function mysql_connect()

March 13, 2021 by Code Error
Posted By: Anonymous

I am trying to do a simple connection with XAMPP and MySQL server, but whenever I try to enter data or connect to the database, I get this error.

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:xampphtdocsregister.php:22
Stack trace: #0 {main} thrown in C:xampphtdocsregister.php on line 22

Example of line 22:

$link = mysql_connect($mysql_hostname , $mysql_username);

Solution

mysql_* functions have been removed in PHP 7.

You probably have PHP 7 in XAMPP. You now have two alternatives: MySQLi and PDO.

Additionally, here is a nice wiki page about PDO.

Answered By: Anonymous

Related Articles

  • How to remove MySQL completely with config and…
  • Are PDO prepared statements sufficient to prevent…
  • Logging best practices
  • Mysqli real_escape_string validation not working,…
  • slim php get route with parameter (user login system)
  • Should MySQL have its timezone set to UTC?
  • How to change mysql to mysqli?
  • PHP A Good way to pass the PDO Object into other…
  • The mysql extension is deprecated and will be…
  • How do I import a .sql file in mysql database using PHP?
  • How can I prevent SQL injection in PHP?
  • Error: Can't set headers after they are sent to the client
  • Can't install via pip because of egg_info error
  • mysqli::mysqli(): (HY000/2002): Can't connect to…
  • How to create a temporary table in SSIS control flow…
  • error: 'Can't connect to local MySQL server through…
  • How do I count unique visitors to my site?
  • phpMyAdmin on MySQL 8.0
  • UTF-8 all the way through
  • mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_…
  • Why the REPL is not showing the full trace of the…
  • Call to undefined method mysqli_stmt::get_result
  • Howto: Clean a mysql InnoDB storage engine?
  • After a little scroll, the sticky navbar just is not…
  • From inside of a Docker container, how do I connect…
  • com.mysql.jdbc.exceptions.jdbc4.CommunicationsExcept…
  • ERROR 1698 (28000): Access denied for user…
  • java.sql.SQLException: Access denied for user…
  • simple php script, unable return json
  • ERROR 2013 (HY000): Lost connection to MySQL server…
  • java.sql.SQLException: - ORA-01000: maximum open…
  • SQL query return data from multiple tables
  • How can I initialize a MySQL database with schema in…
  • How to Update Database from Assets Folder in App
  • How to use multiple databases in Laravel
  • Can not connect to amazon RDS from spring boot container app
  • TLS 1.3 server socket with Java 11 and self-signed…
  • How do I use MySQL through XAMPP?
  • How do I get the last inserted ID of a MySQL table in PHP?
  • How to set root password to null
  • mysql.h file can't be found
  • How can I fix MySQL error #1064?
  • Headers and client library minor version mismatch
  • How to use java.net.URLConnection to fire and handle…
  • XAMPP - MySQL shutdown unexpectedly
  • PDO support for multiple queries (PDO_MYSQL, PDO_MYSQLND)
  • Jdbc:Connection is returning null in my program what to do?
  • MySQL server has gone away - in exactly 60 seconds
  • How to change XAMPP apache server port?
  • How do SO_REUSEADDR and SO_REUSEPORT differ?
  • how to configure hibernate config file for sql server
  • Unfortunately MyApp has stopped. How can I solve this?
  • XAMPP MySQL password setting (Can not enter in PHPMYADMIN)
  • MySQL ERROR 1045 (28000): Access denied for user…
  • Database development mistakes made by application developers
  • How do you connect to multiple MySQL databases on a…
  • The definitive guide to form-based website authentication
  • How to include a PHP variable inside a MySQL statement
  • jQuery Mobile: document ready vs. page events
  • PHP Connection failed: SQLSTATE[HY000] [2002]…
  • What's the difference between Instant and LocalDateTime?
  • What is a stack trace, and how can I use it to debug…
  • "The system cannot find the file specified"
  • How to prevent scrolling the whole page?
  • Pentaho Data Integration SQL connection
  • How do I obtain a Query Execution Plan in SQL Server?
  • Reference — What does this symbol mean in PHP?
  • trying to create a dynamic swiper
  • MySQL database is not receiving any data in PHP
  • Cannot connect to MySQL 4.1+ using old authentication
  • Pandas create the new columns based on the distinct…
  • Installing PDO driver on MySQL Linux server
  • How to create a new database after initally…
  • How to use PDO to fetch results array in PHP?
  • Fatal error: Call to undefined function…
  • How to change the MySQL root account password on CentOS7?
  • List all the files and folders in a Directory with…
  • How to get UTF-8 working in Java webapps?
  • Kafka-Elasticsearch Sink Connector not working
  • open telemetry InMemorySpanExporter not reseting…
  • What do I do next to block sign MySQL query attempts…
  • MySQL fails on: mysql "ERROR 1524 (HY000): Plugin…
  • How do I get the current time zone of MySQL?
  • Integrating Discogs disconnect node module in…
  • PHP mysql insert date format
  • ExecuteReader requires an open and available…
  • How can I enable the MySQLi extension in PHP 7?
  • Error: request entity too large
  • Firebase deployng Sapper app as cloud function failed
  • How can I solve a connection pool problem between…
  • xampp MySQL does not start
  • How does PHP 'foreach' actually work?
  • Can't connect to local MySQL server through socket…
  • What does "Fatal error: Unexpectedly found nil while…
  • mysqli::query(): Couldn't fetch mysqli
  • Unable to solve java.sql.SQLException even after…
  • Retrieve datas with MySQL & Backbone JS
  • How to handle a redis connection error in express?
  • Ubuntu: OpenJDK 8 - Unable to locate package
  • Sending an HTTP POST request on iOS

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

What is a non-capturing group in regular expressions?

Next Post:

Sort an array in Java

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error