Style questions: variable in echo, preparing sql queries
| From: | Chris Lott | Date: | Wed, 22 Nov 2000 15:11:50 +0000 |
| Subject: | Style questions: variable in echo, preparing sql queries | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26637@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Two questions about style:
1) echo "PartID is $PartID";
seems to work fine. Is there a reason that I see others use:
echo "PartID is " . $PartID;
2) When querying a db, I see users who do something like:
$sql = "select foo from bar";
$results = mysql_query("$sql")
Is there a reason not to just put the SQL code directly in the function:
$results=mysql_query("select foo from bar") ?
c
-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt http://irfaiad.virtualave.net/
Comment: PGP Signed for message authentication and verification
Comment: KeyID: 0xD68B61E851046CFD
iQA/AwUBOhviMtaLYehRBGz9EQIuDQCg36ncNJjE6+9t9hzdN+UpQbdsKB0AoKvu
iTO3SdgXpxg7v5QXLkRDGgco
=gcug
-----END PGP SIGNATURE-----