mwstewart Posted March 4, 2007 Share Posted March 4, 2007 I've been wondering for a while what is the best syntax to query the DB: Is it the shorthand way: <?php $rsUnactivated=mysql_fetch_assoc(mysql_query("SELECT * FROM tblUsersUnactivated WHERE ActivationID = '$_GET[activationid]' ")); ?> Or the 'longhand' way: <?php $sql = "SELECT * FROM tblUsersUnactivated WHERE ActivationID = '$_GET[activationid]' "; $query = mysql_query($sql); $resultSet = mysql_fetch_assoc($query)?> Which is better and why? Link to comment https://forums.phpfreaks.com/topic/41168-syntax-for-querying-a-db/ Share on other sites More sharing options...
rcorlew Posted March 5, 2007 Share Posted March 5, 2007 I use longhand. I have found that you may need to setup another query again and if the sql is already loaded then you can just write another query. Rembe to always close your sql link at the end of each script. Link to comment https://forums.phpfreaks.com/topic/41168-syntax-for-querying-a-db/#findComment-199654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.