Jump to content

Syntax for querying a DB


mwstewart

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.