PHP Connect to the MySQL Server connecting to mysql database php android connecting to php mysql How to access a MySQL database with PHP code How …
Original source
PHP Tutorial for Beginners 30 # How to connect to MySQL database using PHP

PHP Connect to the MySQL Server connecting to mysql database php android connecting to php mysql How to access a MySQL database with PHP code How …
Original source
22 responses to “PHP Tutorial for Beginners 30 # How to connect to MySQL database using PHP”
latest connection code is here,
$host = 'localhost';
$user = 'root';
$password = '';
$db = 'test';
$con = @mysqli_connect($host, $user, $password, $db);
if (!$con)
{
die('cannot connect to the database!');
}
else
{
@mysqli_select_db($con, "test");
echo 'success';
}
i got this error (i am using windows 10)
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in F:xampphtdocsphpexamplesdatabaseconnect.php:9 Stack trace: #0 {main} thrown in F:xampphtdocsphpexamplesdatabaseconnect.php on line 9
helpful but i think a but old tutorial……
mysql_connect() is depecrated. use mysqli_connect() instead
Helpful!
thankyou ..
i was getting error 500 in my chrome (Ubuntu 16.04 LTS)
and firefox shows just a white screen
everything worked and including echo, except "mysql_connect"
at last, it it was "mysqli_connect" in php7.0
that "i" wasted my 5 days (reinstalled ubuntu, ,lamp ,phpmyadmin…. and running many commands in terminal)
i am writing that, because it can save 5 days of someone.. lol
The way ur explaining it awesome …. But ur jumbling and gambling the word which will confuse person to think or hear you again and again to knew wat u really want to do …. it
Enjoying your videos but i get a fatal error:call to undefined function mysql_connect in C..
Any help?
hii sir I got some problem on link front end and back end.
I created frontend use html code and backend database is MySQL
hello sir,why code is printed on a screen while connecting to database?
says a lot that 40,000 people couldnt figure it out by looking in the sql program / php program
<?php
$mysql_host='localhost';
$mysql_user='root';
$mysql_password='';
if(!@mysql_connect($mysql_host,$mysql_user,$mysql_password))
{
die('cannot connect to database');
}
else
if(@mysql_select_db('login'));
{
echo 'connection success';
}
?>
what all is written in rows 16, 17 and 18 should be removed for the connect.php to work.
Syntax ERROR AT last few lines:
else{
die('error, unable to connect');
}
?>
My phpMyAdmin doesnt have a users tab
waste
Thanks a lot
I need your help sir…!!! plz provide your email id so I can send my created page
Yeah Thank U Sir Now I'm not worry.
Now I can get easily connected to database Successfully.
Thanks a lot Good Bye.
@Soheli N..your computer login password
if i have no mysql password then what will be my password in php??????????
It showing null in the browser