Quick php/MySQL syntax question!

Associate
Joined
15 Jan 2003
Posts
1,117
Location
Bristol/Manchester Uni
Hey,

I'm new to php/MySQL and am currently working through a php/MySQL tutorial/book... I'm getting along well with it, but one thing that is bugging me is part of the syntax the book tells me to add in, yet has not explained it at all!.. So I was thinking maybe its something really insignificant, but for when I'm writing my own scripts from scratch I would really like to understand WHY I'm including each part, and the necessity for it etc..

So anyways what I want to know is what the ' . ' means.?

For example:

PHP:
$dbcnx = @mysql_connect('localhost', 'root', 'mypassword');
 if (!dbcnx) {
   exit('<p>Unable to connect to the ' .
        'database server at this time.</p>');
}

So in the above connection to the MySQL server I'm adding a custom error message, BUT what and why has the tutorial/book told me to add ' . after 'connect to the' .. then ' before the 'database server at...' etc.

If anyone could clear this up, it would be great!.. as I have no idea as to why its used, and what it does etc.. I've also used it when inserting php functions within an error message, such as..

PHP:
Error: ' . mysql_error() . '

Any help on clearing this question up, would be great!

Thanks, ;)
 
Thats much clearer thanks a lot!.. Makes sense, although I to can not understand why in the majority of the examples it has the concatenation operator in place to join two text strings..

The mysql_error() also makes more sense now, as I can understand that putting it within the single quotes would not output its value..

Thanks again. ;)
 
Back
Top Bottom