For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > May 2005 > join selects









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author join selects
Irlan agous

2005-05-01, 9:01 pm

Hello
i have t tables reactie and form and this query

$sql = "select reactie.persid,form.oproep,form.foto,form.id from
reactie,form
INNER JOIN reactie ON (reactie.persid = form.id) group by reactie.persid
order by reactie.persid DESC LIMIT 0,5";

$result = mysql_query($sql);

Why i always get the error message invalid result resource? I want to group
the persid and order them DESC. But i cant get it to work can someone please
help?

reactie

logid persid
1 2
3 2
4 3

form

id oproep foto
2 bla blabla
3 frt hadiha


coolsti

2005-05-01, 9:01 pm

On Sun, 01 May 2005 20:44:24 +0200, Irlan agous wrote:

> Hello
> i have t tables reactie and form and this query
>
> $sql = "select reactie.persid,form.oproep,form.foto,form.id from
> reactie,form
> INNER JOIN reactie ON (reactie.persid = form.id) group by reactie.persid
> order by reactie.persid DESC LIMIT 0,5";
>
> $result = mysql_query($sql);
>
> Why i always get the error message invalid result resource? I want to group
> the persid and order them DESC. But i cant get it to work can someone please
> help?
>


Did you make a mistake in your query? Do you really want to have this?

... from reactie,form INNER JOIN reactie ON (reactie.persid = form.id) ...

or do you just mean

... from reactie,from where reactie.persid = form.id ....


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com