[PHP] Are left joins more efficient?

2003-07-25 Thread anachronism
Hello,

I program for a website that gets massive loads of traffic. Optimisation has
become an important issue lately.

At the moment, all queries on the website follow the same format when
joining tables:
SELECT * FROM table1,table2 WHERE table1.id=table2.id;

My question is, would this format be more efficient?
SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id;

Over the last couple of years I have read and heard two different answers.
Years ago it was said that doing Left Joins are faster and more efficient.
But with recent updates to MySQL I have read that both queries are broken
down and optimised the same way by MySQL.

Any thoughts? I havn't come across any comparisons on the web, so any
answers would be appreciated.

(couldn't find any mysql specific groups so i'm posting in the next best
thing!)

Thanks

-Dennis





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Detecting If A Variable Arrives At A Page From A Get Or A Post...

2003-07-25 Thread anachronism
Quick question...

I was wondering if there is a way to detect if any given variable came in to
a page via post, or a get from a form.

Any help would be appreciated.

Thanks,
Dennis



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Global variables in a class? Nested classes VS inheritance...

2003-07-30 Thread anachronism
Hello,

I'm lookin for some tips on the best way to do this...

I make a database connection outside of my classes... lets call it
$myDBConnection. I need to use this connection in a class nested in a
class... Was wondering the most efficient way of doing this? I don't want to
create a new db connection in the class. I want to use the existing one...

If no one has a better Idea I'll pass the connection through the constructor
of the first class, and then again into the constructor of the nested
class... then I can query and use the database connection as
$this->myDBConnection Just wanted to avoid that because there's about 5
db connections I'll have to pass in...

Any thoughts? Would it make things easyer if the base class inherited all
nested classes instead of nesting them?

Any help would be appreciated.

Thanks

-Dennis



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Class Design Question...

2003-08-14 Thread anachronism
Hello,

I'm rewriting a lot of code and have decided to use classes... I'm wondering
if this would be considered bad design or not...

Basically in the class I have methods that perform a task, and return true
on success, or false on failure. Easy enough. If it returns false however, I
want to display errors for the user. The best way I can think of doing this
is adding a member variable to the class (an array). With each error
encountered it would push them on the array and at the end of the function
return false. Then in the code I would check if it returned false, and if so
dive into the error member variable array of the class and display them...

For example:

if($user->login($username, $password))
  echo "You have successfully logged in.";
else{

  foreach($user->loginError as $err){

echo $err . "";

  }

}

This sound like good design? Any suggestions?

Thanks...

-Dennis



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php