I'm intermediate PHP coder, and I'm new in CODECALL.
So I wanted to share my knowledge to beginner coders!
Connect to MYSQL:
Connecting to mysql is very easy to learn and to code, and when you're using
<?php include ("yourfile.php"); ?>, you can get connection to your every files!
Create PHP file named eg. "connect.php", and start writing 1st code into it!
I'm going to use variables in code so it will be simple, so first start with variables like this:
<?php $host = " " $user = " " $pass = " " ?>Inside the quotes write your details, details must be correct otherwise connection will fail!
Now lets continue the code and write more code:
$connection = mysql_connect($host,$user,$pass) or die ();We created variable with name "connection" which stores a mysql_connect(servername,username,password); function.
Attention: servername is our variable $host
username is our variable $user
password is our variable $pass
Now we should have:
<?php $host = "Your SERVERNAME here" $user = "Your USERNAME here" $pass = "Your PASSWORD here" $connection = mysql_connect($host,$user,$pass) or die (); echo "Connected to MYSQL"; ?>Added just one echo writing under the mysql_connect function, so remember to add it too!
Now just try to run the code and see if its working!
Any problems? Reply!


Sign In
Create Account


Back to top









