使用mysql和php的对象运算符

Hey guys am new to php development and i have seen a code like

$link = mysql_connect('localhost', 'root', 'root');
if ($link) {
    die('cannot connect:'.mysql_error());
}
mysql_select_db("chat", $link);

if ($SERVER['REQUEST_METHOD'] == 'POST') {
$message = $_POST['message'];
mysql_query("INSERT INTO posts (message) VALUES ('$message')");
}

$query = mysql_query('SELECT * FROM posts ORDER BY id DESC');
enter code here

while ($row = mysql_fetch_object($query)) {
$posts[] = array(
    'message' => $row -> message
    );
}

Am confused of what $row->message means??..is it same as $row['message']..

Hope you guys can help Thanks

You can fetch mysql_query result inform of array / object

For array you can use, mysql_fetch_array(); http://www.php.net/manual/en/function.mysql-fetch-array.php

For objects you can use, mysql_fetch_object(); http://www.php.net/manual/en/function.mysql-fetch-object.php

Also , mysql is depricated now from PHP. So you can use PDO / Mysqli

http://in1.php.net/manual/en/book.pdo.php