Hi I have recently started working with PHP and am making a
neighborhood website. I am connecting to my Mysql database and am
having difficulty understanding what is happening in the example on
the PHP website. It connects fine but I do not understand the code.
I do not just like to take other people's code so if someone can
explain this to me that would be great.
<?php
$link = mysql_connect(' localhost', 'mysql_user', 'mysql_password ');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($li nk);
?>
I do not understand the if (!$link) part
what does the ! mean and what is the value of link?
thank you
neighborhood website. I am connecting to my Mysql database and am
having difficulty understanding what is happening in the example on
the PHP website. It connects fine but I do not understand the code.
I do not just like to take other people's code so if someone can
explain this to me that would be great.
<?php
$link = mysql_connect(' localhost', 'mysql_user', 'mysql_password ');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($li nk);
?>
I do not understand the if (!$link) part
what does the ! mean and what is the value of link?
thank you
Comment