Topic: how to perform mysql join in php??
hello.. can anybody tell me how to join 2 mysql tables in php?
You are not logged in. Please login or register.
PunBB Forums → Programming → how to perform mysql join in php??
hello.. can anybody tell me how to join 2 mysql tables 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());
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
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
what is the difference between innerjoin and left join?
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
PunBB Forums → Programming → how to perform mysql join in php??
Powered by PunBB, supported by Informer Technologies, Inc.