You wrote:
"Ryan Fischer" <[EMAIL PROTECTED]> wrote in message
01d901c1101e$9cd43220$80c93fd0@ryan">news:01d901c1101e$9cd43220$80c93fd0@ryan...
> 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);

"Marcus Hartmann" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
the statement should look like this:
> $result = mysql_query("select * from table where type = 'Base' and x =
'x' and
> y = 'y'");

Oops.  And I see one other mistake here, too.  The query really should
be:

$result = mysql_query("select * from table where type = 'Base' and x =
'$x' and y = '$y'");

--
 -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/



-- 
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]

Reply via email to