You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2021-11-19 23:25:45

aziz
Member
Registered: 2021-03-30
Posts: 109

connect to mysql using php

hello guys,
I'm new to php I want to connect to glpi database I tried this code :
<?php
$dbServername ="localhost";
$dbUsername="root";
$dbPassword ="";
$dbName="glpi";

$conn= mysql_connect($dbServername, $dbUsername, $dbPassword, $dbName);
?>

but got this error

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\lar\serveur_php.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\lar\serveur_php.php on line 7

appreciate any help guys

Offline

#2 2021-11-24 18:00:36

n00b73
Member
Registered: 2021-11-24
Posts: 2

Re: connect to mysql using php

You can use mysqli_connect($mysql_hostname , $mysql_username) instead of mysql_connect($mysql_hostname , $mysql_username).

mysql_* functions were removed as of PHP 7. You now have two alternatives: MySQLi and PDO.

Offline

Board footer

Powered by FluxBB