On Mar 20, 2008, at 922AM, Lamp Lists wrote:
$query = mysql_query("SELECT * FROM table1 WHERE id='{$session_id}'");
For a non-array value, the curly braces are unnecessary:
$query = mysql_query("SELECT * FROM table1 WHERE id='$session_id'")
WIth an array element, you have to either use the curly braces or do
as you have and end the string, concat the value and start the string
again as needed.
$query = mysql_query("SELECT * FROM table1 WHERE id='{$clean['id']}'")
When dealing with array elements, I use the curly braces method. IMO
it's cleaner and easier to read.
I would use:
$parameters = array(
'param1' => $_POST["param1"],
'param2' => $_POST["param2"]
);
This is how I do it as well.
does it really matter? is there really difference or these are just
two "styles"?
IMO, it's a matter of preference and style. There may be performance
differences between the two, but I doubt that either one is so much
worse than the other that it would have a noticeable impact on your
script in most situations.
Brady
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php