Re: MySQL Query

From: Date: Thu, 19 Jul 2001 06:47:00 +0000
Subject: Re: MySQL Query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58618@lists.php.net to get a copy of this message
You wrote: > I have a table that looks like > > Name | Type | X | Y > > Foo | Ship | 9 | 29 > Bar | Base | 9 | 29 > > Is there any way I can write a query that selects > everything with Type = Base, and X and Y = Foo's X and Y? > > ie > > "Select * from table where type = Base and X = {Foo:X} and Y = {Foo:Y}"; $result = mysql_query("select x, y from table where name = 'Foo'"); $info = mysql_fetch_object($result); $x = $info->x; $y = $info->y; mysql_free_result($result); $result = mysql_query("select * from table where type = 'Base', x = 'x', y = 'y'"); $info = mysql_fetch_object($result); // Use properties of $info here. mysql_free_result($result); I think your reasoning is a little jumbled, though. There may be some way to do what you want to do with one query. There usually is for the simple things. I'm not quite sure what you want to accomplish, though. HTH. :) -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/

« previous php.general (#58618) next »