0

Hi..
I'm really new in php..
and cant understand a part from this code below and hope somebody could explain to me :

while ($subject = mysql_fetch_array($subject_set)) {
			echo "<li>{$subject["menu_name"]}</li>";
			$page_set = mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}", $connection);
			if (!$page_set) {
				die("Database query failed: " . mysql_error());
			}

			echo "<ul class=\"pages\">";
			while ($page = mysql_fetch_array($page_set)) {
				echo "<li>{$page["menu_name"]}</li>";
			}
			echo "</ul>";
		}

The thing that i need explanation is that what is the meaning of curly braces "{" there
in {$subject["menu_name"]} and {$subject["id"]} ?

could you tell me the difference of the usage between those two?
because,i realize that it is just fine if i remove the curly braces on {$subject["menu_name"]} and doing something else but not on {$subject["id"]} .

Help me please..
Thank You :)

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by JRM
0

The braces casue to PHP to parse the array and return the value found in that cell.
Try removing them. You will get an error.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.