Topic: how to perform mysql join in php??

hello.. can anybody tell me how to join 2 mysql tables in php?

Re: how to perform mysql join in php??

From PunBB index.php, where the forums and categories are fetched from the database:

$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster, f.closed FROM categories AS c INNER JOIN forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());

Re: how to perform mysql join in php??

Dear infeeneetee,

$dbh=mysql_connect ("localhost", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("dbname");


Repeat it again for another.



Thanks

Mr. IT
0092-300-5239065
AliSoft .Net
http://www.alisoft.net

Re: how to perform mysql join in php??

i dont think thats what he wants to do, i think he wants to take something like table a and combine it with table b

sorry, but i have no clue on how to do this

Indocron
$theQuestion = (2*b) || !(2*b);

Re: how to perform mysql join in php??

what is the difference between innerjoin and left join?

6 (edited by zaher 2004-10-25 00:04)

Re: how to perform mysql join in php??

inner join filter both of two tables, intersect tables, if there is no info in table2 will skip the record in table1
left join filter the joined tables, get table1 and if there is info in table2 to thay get it or get null

If your people come crazy, you will not need to your mind any more.