dardime Posted January 18, 2016 Share Posted January 18, 2016 Hi I need help in joining two database output: tblog and tbassignlog with the same fields both of them. mysql_select_db($database_localhost, $localhost); $query_rs = sprintf("SELECT * FROM tblog WHERE cJN = '%s' ORDER BY dtDate DESC", $colname_rs); $rs = mysql_query($query_rs, $localhost) or die(mysql_error()); $row_rs = mysql_fetch_assoc($rs); $totalRows_rs = mysql_num_rows($rs); Thank you in advance. Quote Link to comment https://forums.phpfreaks.com/topic/300488-joining-two-tables/ Share on other sites More sharing options...
benanamen Posted January 18, 2016 Share Posted January 18, 2016 (edited) dardime, it is seriously time to stop using deprecated Mysql code. It is not going to work at all in the latest version of Php no matter what you do. Those functions simply no longer exist in Php. You need to use PDO with prepared statements or at the very least mysqli. Edited January 18, 2016 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/300488-joining-two-tables/#findComment-1529940 Share on other sites More sharing options...
Zane Posted January 18, 2016 Share Posted January 18, 2016 From the looks of your example, you haven't even tried to join two tables.. I only see one in your query. Look up "inner join" or "sql joins" on google. And, yea... mysql_ code is about as dead as IE8/9 right now. $c = new mysqli("server", "username", "password", "database name"); $q = $c->query("SELECT 1"); $a = $query->fetch_assoc(); Quote Link to comment https://forums.phpfreaks.com/topic/300488-joining-two-tables/#findComment-1529947 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.