[PHP] clause

2001-08-27 Thread Jeremy Morano

Hi,

Can somebody help me out?
My where clause is completely being ignored.
More specifically the . I tried to use != and that didn't work either.
However, when I substitute it with an = , It fuctions correctly.

Right now, the output is all the users.uid and all the users.username from
the table users.
H E L P !



$connection = @mysql_connect(l, c, c) or die(Couldn't connect.);

$db = @mysql_select_db($db_name, $connection) or die(Couldn't select
database.);

$sql = SELECT distinct users.uid , users.username
FROM users, picks
WHERE picks.users_uid  users.uid
;

$result = @mysql_query($sql,$connection) or die(Couldn't execute query.);


while ($row = mysql_fetch_array($result)) {
$uid = $row['uid'];
$username = $row['username'];

$option_block .= option value=\$uid\$username/option;
}


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] clause

2001-08-27 Thread ERISEN, Mehmet Kamil

Hello Jeremy,
you are using two tables, but you are not joining them.
What's you goal?

--- Jeremy Morano [EMAIL PROTECTED] wrote:
 Hi,
 
 Can somebody help me out?
 My where clause is completely being ignored.
 More specifically the . I tried to use != and that
 didn't work either.
 However, when I substitute it with an = , It fuctions
 correctly.
 
 Right now, the output is all the users.uid and all the
 users.username from
 the table users.
 H E L P !
 
 
 
 $connection = @mysql_connect(l, c, c) or
 die(Couldn't connect.);
 
 $db = @mysql_select_db($db_name, $connection) or
 die(Couldn't select
 database.);
 
 $sql = SELECT distinct users.uid , users.username
   FROM users, picks
   WHERE picks.users_uid  users.uid
   ;
 
 $result = @mysql_query($sql,$connection) or die(Couldn't
 execute query.);
 
 
 while ($row = mysql_fetch_array($result)) {
   $uid = $row['uid'];
   $username = $row['username'];
 
   $option_block .= option
 value=\$uid\$username/option;
 }
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] clause

2001-08-27 Thread Andrey Hristov

I don't know if this will help but why not to try
$sql = SELECT distinct users.uid , users.username
 FROM users LEFT JOIN picks USING(uid)
WHERE picks.users_uid  users.uid

Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%

- Original Message - 
From: Jeremy Morano [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 27, 2001 9:52 PM
Subject: [PHP] clause


 Hi,
 
 Can somebody help me out?
 My where clause is completely being ignored.
 More specifically the . I tried to use != and that didn't work either.
 However, when I substitute it with an = , It fuctions correctly.
 
 Right now, the output is all the users.uid and all the users.username from
 the table users.
 H E L P !
 
 
 
 $connection = @mysql_connect(l, c, c) or die(Couldn't connect.);
 
 $db = @mysql_select_db($db_name, $connection) or die(Couldn't select
 database.);
 
 $sql = SELECT distinct users.uid , users.username
 FROM users, picks
 WHERE picks.users_uid  users.uid
 ;
 
 $result = @mysql_query($sql,$connection) or die(Couldn't execute query.);
 
 
 while ($row = mysql_fetch_array($result)) {
 $uid = $row['uid'];
 $username = $row['username'];
 
 $option_block .= option value=\$uid\$username/option;
 }
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] clause

2001-08-27 Thread ERISEN, Mehmet Kamil

HEllo,
I think this will better work. What Jeremy wants to do is
to OUTER joing the tables:
SELECT distinct users.uid , users.username
FROM users LEFT OUTER JOIN picks using(uid)

may do the trick.

If you say letf join and the use ids not equal in the
where, then I think it's same as saying:
where uid = pid
and   uid != pid 
and will always be false.


REF:
http://www.mysql.com/doc/J/O/JOIN.html

--- Andrey Hristov [EMAIL PROTECTED] wrote:
 I don't know if this will help but why not to try
 $sql = SELECT distinct users.uid , users.username
  FROM users LEFT JOIN picks USING(uid)
 WHERE picks.users_uid  users.uid
 
 Andrey Hristov
 IcyGEN Corporation
 http://www.icygen.com
 99%
 
 - Original Message - 
 From: Jeremy Morano [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, August 27, 2001 9:52 PM
 Subject: [PHP] clause
 
 
  Hi,
  
  Can somebody help me out?
  My where clause is completely being ignored.
  More specifically the . I tried to use != and that
 didn't work either.
  However, when I substitute it with an = , It fuctions
 correctly.
  
  Right now, the output is all the users.uid and all the
 users.username from
  the table users.
  H E L P !
  
  
  
  $connection = @mysql_connect(l, c, c) or
 die(Couldn't connect.);
  
  $db = @mysql_select_db($db_name, $connection) or
 die(Couldn't select
  database.);
  
  $sql = SELECT distinct users.uid , users.username
  FROM users, picks
  WHERE picks.users_uid  users.uid
  ;
  
  $result = @mysql_query($sql,$connection) or
 die(Couldn't execute query.);
  
  
  while ($row = mysql_fetch_array($result)) {
  $uid = $row['uid'];
  $username = $row['username'];
  
  $option_block .= option
 value=\$uid\$username/option;
  }
  
  
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
  To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
  
  
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 To contact the list administrators, e-mail:
 [EMAIL PROTECTED]
 


=
Mehmet Erisen
http://www.erisen.com

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]