acctman Posted April 9, 2009 Share Posted April 9, 2009 how can I combine these two queries into one? thanks in advance $en['m_date'] = mysql_result(mysql_query("SELECT m_date FROM rate_members WHERE m_id='".$en[msg_sender]."'"), 0, "m_date"); $en['m_user'] = mysql_result(mysql_query("SELECT m_user FROM rate_members WHERE m_id='".$en[msg_sender]."'"), 0, "m_user"); $en['date_y'] = date("Y", $en['m_date']); $en['date_m'] = date("m", $en['m_date']); Quote Link to comment https://forums.phpfreaks.com/topic/153348-solved-combing-two-sql-queries/ Share on other sites More sharing options...
Maq Posted April 9, 2009 Share Posted April 9, 2009 I don't like using mysql_result, I prefer this technique: $sql = "SELECT m_date, m_user FROM rate_members WHERE m_id = '{$en['msg_sender']}'"; $result = msyql_query($sql) or die(mysql_error()); $row = mysql_fetch_array($result); echo "Date=> " . $row['m_date'] . " User=> " . $row['m_user']; Quote Link to comment https://forums.phpfreaks.com/topic/153348-solved-combing-two-sql-queries/#findComment-805665 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.