Jump to content

[SOLVED] combing two sql queries


acctman

Recommended Posts

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']);

Link to comment
https://forums.phpfreaks.com/topic/153348-solved-combing-two-sql-queries/
Share on other sites

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'];

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.