How do you do your queries?

PythonPython Forum LeaderThe Royal RAM
If your not using a class to execute your queries how would you normally do it... which one of the follwoing or even different perhaps...

One:[PHP]$query = "SELECT * FROM `table`";
$result = mysql_query($query) or die ("Error");[/PHP]

Two:[PHP]$result = mysql_query("SELECT * FROM `table`") or die ("Error");[/PHP]

Its basically down to preference but which do you do?

The Royal Ram

Comments

  • ArestiaArestia Member NAT Warrior
    i do it #1 way
    Arestia Design Studios / Synapse Corporate Solutions
    Daniel L. Rust - Lead Architect
    Seattle, WA
  • ChroderChroder Senior Member The Royal RAM
    Long queries, #1, short queries, #2. (Though I don't usually use 'or die' in production code).
  • PythonPython Forum Leader The Royal RAM
    Yeah I do it a bit of both. If the query is going to be reused later on or if its going to be modified later in the script then I opt for method one but if not I simple use method 2.

    And yes I generally done use the die function on my live sites except when testing for errors... etc... Because I usually just use if else statements to check to see if there are errors... etc

    The Royal Ram

Sign In or Register to comment.