Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What do the . do? 2

Status
Not open for further replies.

sazebac

Technical User
Joined
Apr 16, 2003
Messages
117
Location
US
Could someone tell me what the . do in PHP as in the following Insert Statement:
"INSERT INTO region VALUES
(NULL, " .
"\"" . $regionName . "\", " .
"\"" . $description . "\", " .
"NULL)";

also, what do the "\"" do? Thanks.
 
The .'s append

the \'s are escape characters.

Let me elaborate.
Code:
$name = "sazebac";
$my_string = "Hello, how are you ".$name;
echo $my_string;

would print, Hello, how are you sazebac.

$my_string = 'Hello, how're you doing today sazebac';

Would result in an error, because the string ends at the apostrophie in how're... so you escape the apostrophe ...

$my_string = 'Hello, how\'re you doing today sazebac';

such that the parser knows to not end the string there.

-Rob
 
Thanks for the input. I'm trying to figure out the following code and there's a few characters I don't understand. IN the following code:
-------------------------------------------------------
input
if (empty($regionName) || empty($description))
{
?>
--------------------------------------------------------

is the || supposed to mean concatenate the two?

------------------------------------------------------
else
{
if (!($connection = @ mysql_connect($hostName,
$username,
$password)))
die("Could not connect to database");

if (!mysql_select_db($databaseName, $connection))
showerror();

---------------------------------------------------------
what does the @ symbol represent?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top