Re: [PHP-DB] WHERE statement used multiple times.

2003-10-19 Thread Chris Wanstrath
On Mon, 2003-10-20 at 00:56, JeRRy wrote:
   Hi,
  
  If I was to want to use the WHERE statement multiple
  times (more than once) how do I seperate each WHERE
  statement?
  
  Would it be with a ',' (coma) or a ' ' (space) or
  what?  Or not possible to have multiple WHERE's in
  the
  one query?
  
  I need 2 tables checked before executing the
  results. 
  So that is why I need 2 WHERE statements done.  
  
  Thanks!
  
  http://personals.yahoo.com.au - Yahoo! Personals
  New people, new possibilities. FREE for a limited
 time. 

You can put together WHERE statements with an AND or an OR.  For
instance, SELECT id FROM users WHERE id='2' OR id='3'

You know, if you had a few suspicions about this sort of thing you could
always give it a spin in a Query.  Worst case scenario is you will get
an error.

- Chris

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



Re: [PHP-DB] Variables not working within Functions

2003-10-15 Thread Chris Wanstrath
You are using a variable outside of the function's scope.
In the function, do this:
global $username;

Visit www.php.net/man to get a better understanding of globals and
scope.

On Wed, 2003-10-15 at 22:10, Adam Symonds wrote:
 Hi,
 I am starting to us functions with my work but I am having troubles
 With the variables in the functions..
 
 If I have the following function called from my page it will work but the
 variable wont
 ($username)
 but if I put this code straight on the page then it works fine..
 
 Any reason for the variable not to work in the function but in straight
 coding?
 Thanx
 
 
 
 Sample Function Below:
 
 ==
 function LoginSystem()
  {
 echo div align=right;
 if ( !isset( $_SESSION['login'] ) ) {
 
 echo form action=../Users/Login.php method=post;
 echo font size=1Username: /fontinput name=user type=text
 size=10nbsp;font size=1Password: /fontinput name=pass type=password
 size=10nbsp;input type=submit value=GObr;
 echo a href=../Register.phpfont size=1Not A Member
 Yet?/font/font/anbsp;;
 echo /form;
 
  } else {
 echo font size=1Welcome $username nbsp;nbsp;nbsp;a
 href=../Users/Logout.phpfont
 size=1Logout/anbsp;nbsp;nbsp;/font/fontbrbr;
 }
 echo /div;
  }

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