Jump to content

joining two tables


dardime

Recommended Posts

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.

 

Link to comment
Share on other sites

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 by benanamen
Link to comment
Share on other sites

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();
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.