robert_gsfame Posted January 22, 2010 Share Posted January 22, 2010 what is the different between "SELECT * FROM table WHERE id='{$id}' and "SELECT * FROM table WHERE id='id'" what is the really use of bracket "{}" in the query thx Quote Link to comment https://forums.phpfreaks.com/topic/189383-id-confused/ Share on other sites More sharing options...
roopurt18 Posted January 22, 2010 Share Posted January 22, 2010 This is actually a PHP question. PHP has several different ways in which you can specify strings: single quotes, double quotes, HEREDOC, and one other I think. When using double-quoted or HEREDOC strings, you can use curly brackets as a shortcut to string concatenation. <?php $somevar = 'Fred'; echo 'Hello, ' . $somevar . "\n"; echo "Hello, " . $somevar . "\n"; echo "Hello, {$somevar}\n"; ?> Those should all produce the same thing. Quote Link to comment https://forums.phpfreaks.com/topic/189383-id-confused/#findComment-1000082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.